Skip to main content

First try

Before getting into any detailed knowledge, it's a good idea to try your first project. You'll have a first impression of what your board can do. Let's blink an LED.

Set up software​

At first, you will set up the software for your board.

  1. Open the Visual Studio Code. I believe most of you guys have installed it. We have created an extension for it. It is really handy and easy to use.

  2. Install the extension MadMachine as shown below:

    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
  1. Download the latest mm sdk. It is used to build your project. Choose the version marked with the label Latest. The versions marked with Pre-release are still for internal testing.

  2. Open the Settings by clicking Code / Preferences / Settings to set the extension.

Open the settings window
  1. Click Extensions to expand it and find MadMachine. Indicate the mm sdk location in the box that matches your operating system. If you change the location of sdk later, you will need to update it again.
Set the path of sdk

OK, the software gets preparedπŸ‘.

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 functionalities. Click New Project.
Create a new project
  1. Choose the project as an executable. Your project will run on the board after it is downloaded, so you need an executable. And the projects later in the following sections are all executables.
Choose project type
  1. Choose the board for this project - SwiftIOFeather.
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.

Write code​

Then you will need to edit the code for the project.

  1. Click on the Blink / Sources / Blink / main.swift to open the file. This file stores the main code for your project. So you will always edit this file for all your projects.

  2. Copy the code below into the file. In the next section, you will learn more about the code.

import SwiftIO
import MadBoard

let led = DigitalOut(Id.BLUE)
​
while true {
led.write(true)
sleep(ms: 1000)

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

Download code to the board​

Now you come to the last steps - download your project to the board.

  1. Connect your SwiftIO Feather board to your computer. In the illustration below, the SwiftIO Feather board is pluged into the SwiftIO Circuit Playgrounds board. You can also disconnect them.
Connect your board to computer
  1. Press the download button.
Press the download button
  1. Wait until the onboard LED turns to steady green.
Onboard LED turns to steady green
  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πŸ’‘.