First try
Before diving into the nitty-gritty details, it's always a good idea to get hands-on and try your first project. So, let's kick off your journey by blinking an LED!
We only support macOS 11.0 and above, as well as Linux. Windows is not supported yet.
Step 1: Set up software
At first, you will get started with the software setup process.
1. Install USB driver
Download the macOS driver and unzip it.
Install the dmg format driver in the zip file.
Drag CH34xVCPDriver into Application folder.
Open LaunchPad and open the CH34xVCPDriver app.
Click Open if there is a popup window.
Click the Install button.
If there is a popup message saying System Extension Blocked.
Click Open System Settings button.
Click Allow.
The driver is installed successfully.
- To uninstall the driver, remove the app to Trash.
- Restart the computer before reinstalling the driver.
2. Download mm-sdk
Download the mm-sdk according to your operating system. This sdk is used to build and download your project.
3. Install MadMachine extension for VS Code
In Visual Studio Code,
- click the Extensions button on the left bar.
- enter the extension name MadMachine in the search box.
- click the Install button.
- Click ⚙️ / Extension Settings to open the settings.
- Indicate the mm-sdk location in the box that matches your operating system.
- Mac
- Linux
If you change the location of the SDK later, don't forget to update its path.
OK, the software gets prepared👏.
Step 2: Create a project
Now, you will start your first project.
- Click the Explorer button on the left bar. Then click the extension MadMachine on the bottom to show three buttons. Click New Project.
- Choose the project as an executable. Your project will run on the board, so you need an executable. And the projects in the following sections are all executables.
- Choose the board for this project - SwiftIOMicro.
- Name the project. You could choose any descriptive name you like for the project. Then press the Enter key.
- Choose a location to store the project and press Open.
Well, the project is created and will open in a new window.
Step 3: Write code
Then you will need to edit the code for the project.
- Click on the Sources / main.swift to open the file.
- Copy the code below into the file. In the next section, you will learn how everything works.
import SwiftIO
import MadBoard
let led = DigitalOut(Id.D18)
while true {
led.write(true)
sleep(ms: 500)
led.write(false)
sleep(ms: 500)
}
Step 4: Connect board to computer
Connect your SwiftIO Micro to your computer using a USB cable.
The SwiftIO Micro doesn't require an SD card to run your project.
Step 5: Download code to the board
- Click the Build button to build your project. Wait until the message Done appears on the window.
- Click the Download button. It will take a few seconds.
After it's done, the onboard blue LED starts to blink💡.