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 Feather board.


    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 / Blink / Blink.swift to open the file. You will always edit your code in the file xxx.swift (xxx corresponds to the project name) for all your future projects.
Open the .swift file.
  1. Copy and paste the following sample code into the file.
import SwiftIO
import MadBoard

public struct Blink {
public private(set) var text = "Hello, World!"

public static func main() {
let led = DigitalOut(Id.BLUE)

while true {
sleep(ms: 1000)

sleep(ms: 1000)

The file contains the default code template.

  1. @main signifies the top-level entry point of your program.
  2. The static main() method contains the code to be executed.

Simply put, write the statements to import libraries at the beginning and the program logic within the main() method.