How to use IDE
Now I will show you a brief introduction to MadMachine IDE. Here you can edit, build the code and download it to your board. It simplified the whole process, and thus everyone can get started easily.

Create new project

When you first open the IDE, it will appear as follows. You need to click on Create a new MadMachine project.
Then complete the project info.
    The Project name is necessary for your project.
    Just keep the location as it is. The project folder will be created in the directory Documents/MadMachine/Projects.
    The Project Type decides whether you create an executable project or would like to write a library.
    The Board Type is used to select the right board you deal with.
Click Create.
Or you could choose to Open an existing project if you have created a project before.
And now you will enter the main interface:

Get familiar with IDE

The menu bar on the top contains five different options:
    MadMachine: know about the IDE version, adjust the theme and font size.
    File: create, open and save the file or project.
    Edit: modify your code using some basic operations, such as paste, copy, etc.
    Window: choose the window setup you prefer.
    Help: consult the website for more detailed information.


On the left, there are four buttons. They will be frequently used when you edit a project.
    New file: create a new file for the current project.
    Save all: save all files in the current project.
    build: save the file and build the code you have written.
    download: build the code we have written and then download it to your board.
On the right corner, you can see four buttons:
    : collapse the left Explorer panel. If you want to go back to the default layout, you can click it again.
    : collapse the bottom information panel. If you want to go back to the default layout, you can click it again.
    Serial monitor: send serial data from your computer to the board and receive messages from the board. Make sure you have connected the serial port to your computer with a micro USB cable. When you click on the button, the Serial Monitor will pop up in a new window like this:
Wait several seconds. Select the right UART Port as the following image shows and click Connect.
If you cannot find this port, please close the Serial window and reopen it after a few seconds.
After well connected, the information will begin to appear.
The serial monitor is of great use when there is something wrong with your code. You could print the results of each step to debug your code.


The Explorer panel enables you to find, open and manage the file you have created.
In each project, there are many files. Don't worry, you just need to know some of them:
main.swift is where you write the main code.
Package.mmp is the project file. It is associated with the IDE. You could directly open your project by clicking it.
Package.swift stores all the info about your project. You could modify your dependencies in this file. You will see more about it when dealing with libraries.


Here you can see some built-in example codes for your reference.
Click the second button
on the bottom left corner to show it. There are five folders and each of them contains several projects.
Double click the project and the code will show up in a new window.


In the Editor panel, you can write, edit and modify code. After modification, a small dot will appear next to the file name and it will disappear after you save the file.
    First of all, you need to import the built-in library SwiftIO to enable everything in the library.
    Then, here comes some declaration or initialization of some objects.
    For the code that needs to run over and over again, you should write it in the loop while true.

Status bar

You could confirm the connection of your board with the computer in it. For example, if your SwiftIO board is not connected, it reads "SwiftIOBoard not connected". If the board is connected, it read “SwiftIOBoard ready".


The right bottom part displays the output info about the building process. You can correct your code according to the messages if something goes wrong.
The two buttons on the right side are used to adjust the size of this panel.
Before you download the project to the board, you need to check the board connection. And then, click on the Download
button. You could check here to know how to download your code.
Well, that's all for the introduction of IDE. Come on! Try the example code and then start to code your project.
Last modified 4mo ago