2. Creating a new project
Now, you're ready to code.
- Click the Explorer icon on the left bar. Then click the MadMachine extension on the bottom to show three buttons. Click New Project.

- Choose the project as an executable.

Choose the corresponding board you are going to use. Suppose you're using SwiftIO Feather board.
infoIf 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.

- Name the project. You could choose any descriptive name you like for the project. Then press the Enter key.

- Choose a location to save the project and click Open.

- The project will open in a new window.

- Click on the Explorer
Sources
/Blink
/Blink.swift
to open the file. You will always edit your code in the filexxx.swift
(xxx corresponds to the project name) for all your future projects.

- Copy and paste the following sample code into the file.
Blink.swift
import SwiftIO
import MadBoard
@main
public struct Blink {
public private(set) var text = "Hello, World!"
public static func main() {
let led = DigitalOut(Id.BLUE)
while true {
led.write(true)
sleep(ms: 1000)
led.write(false)
sleep(ms: 1000)
}
}
}

The file contains the default code template.
@main
signifies the top-level entry point of your program.- 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.