Skip to main content

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!

info

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

  1. Download the macOS driver and unzip it.

  2. Install the dmg format driver in the zip file.

  3. Drag CH34xVCPDriver into Application folder.

  4. Open LaunchPad and open the CH34xVCPDriver app.

    Click Open if there is a popup window.
  5. 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.

info
  1. To uninstall the driver, remove the app to Trash.
  2. 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,

  1. click the Extensions button on the left bar.
  2. enter the extension name MadMachine in the search box.
  3. click the Install button.Install the extension
  4. Click ⚙️ / Extension Settings to open the settings.Open the settings window
  5. Indicate the mm-sdk location in the box that matches your operating system.
Indicate the path of sdk on Mac.
info

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.

  1. Click the Explorer button on the left bar. Then click the extension MadMachine on the bottom to show three buttons. Click New Project.
Create a new project
  1. 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 project type
  1. Choose the board for this project - SwiftIOMicro.
Chosse board type
  1. Name the project. You could choose any descriptive name you like for the project. Then press the Enter key.
Set project name
  1. Choose a location to store the project and press Open.
Set project location and name

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.

  1. Click on the Sources / main.swift to open the file.
  2. Copy the code below into the file. In the next section, you will learn how everything works.
main.swift
import SwiftIO
import MadBoard

let led = DigitalOut(Id.D18)

while true {
led.write(true)
sleep(ms: 500)

led.write(false)
sleep(ms: 500)
}
Code

Step 4: Connect board to computer

Connect your SwiftIO Micro to your computer using a USB cable.

Connect your board to computer
info

The SwiftIO Micro doesn't require an SD card to run your project.

Step 5: Download code to the board

  1. Click the Build button to build your project. Wait until the message Done appears on the window.
click build button
  1. Click the Download button. It will take a few seconds.
click download button

After it's done, the onboard blue LED starts to blink💡.