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.
When you first open the IDE, it will appear like this:
First, you should click on Create a new MadMachine project.
Then you need to choose a Project name and Location.
Or you could choose Open an existing project if you have created the project before.
And now you will enter the main interface:
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.
: create a new file for the current project.
: save all files in the current project.
: save the file and build the code you have written.
: 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.
: Send serial data from your computer to the board and receive messages from the board. When you click on it, the Serial Monitor will pop up in a new window like this:
Make sure you have connected the serial port to your computer with a microUSB cable.
Wait several seconds. Select the right UART Port as 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 will be two files by default:
main.swift is where you write main code.
.mmp is the project file and mainly used for library-related stuff here. You could see here for more info.
Here you can see some example codes offered for reference.
Click the second button on the bottom left corner to show it. There are five folders and each of them contain 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 loop
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.
When you download the project to board, you need to wait until a little icon appear in the status bar. And then, click on the Download button. You could know how to download your code here.
Well, that's all for the introduction of IDE. Come on! Try the example code and then start to code your project.