Skip to main content

2. Creating a new project

Now, you're ready to code.

  1. Click the Explorer icon on the left bar. Then click the MadMachine extension on the bottom to show three buttons. Click New Project.
Create a new project.
  1. Choose the project as an executable.
Choose project type.
  1. Choose the corresponding board you are going to use. Suppose you're using SwiftIO Micro.

    info

    If the board type of your project and the board you're using doesn't match, your board cannot recognize the file after downloading. If you want to change the board type, check this tutorial.

Choose the board.
  1. Name the project. You could choose any descriptive name you like for the project. Then press the Enter key.
Enter project name.
  1. Choose a location to save the project and click Open.
Choose a file location.
  1. The project will open in a new window.
Project opened in a new window.
  1. Click on the Explorer Sources / main.swift to open the file.
Open the .swift file.
  1. Copy and paste the following sample code into the file.
main.swift
import SwiftIO
import MadBoard

let led = DigitalOut(Id.BLUE)

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

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