- Getting Started
- Downloading a Program
- Creating a Program
- Communicating with your mbed
The mbed Compiler is an online application used to create your own programs for the mbed microcontroller. It translates program source code that you write in to a program binary that the Microcontroller can execute.
The following instructions demonstrate how to generate the Program Binary used in the Microcontroller Getting Started example.
1. Open the mbed Compiler¶
Open the online compiler using the link in the site menu (top-right of the page). This will open the Compiler in a new tab or window, so you can move back and forth to continue to read these instructions.
2. Create a New Program¶
To create a new program in your personal Program Workspace:
- Right-click (Mac users, Command-Click) on "My Programs", and select "New Program..."
- Enter the name of the new program (e.g. "test"), and click "OK"
Your new program folder will be created under "My Programs".
3. View the default program source code¶
Click on the "main.cpp" file in your new program to open it in the file editor window. This is the main source code file in your program, and by default contains a simple program already. The code should look like:
The other item in the program folder is the "mbed" library - this provides all the useful functions to start up and control the mbed Microcontroller, such as the DigitalOut interface used in this example.
4. Compile and Download the Program¶
To compile the program, click the Compile button in the toolbar. This will compile all the program source code files within the program folder to create a binary program.
- After a successful compile, you will get a "Success!" message in the compiler output and the download dialog will pop up. Save it to the location of the mbed Microcontroller drive, and then hit reset on the microcontroller to start it running!
- If there are errors, they will show up in the "Compiler Output" window, and will need to be fixed!
- Communicating over USB Serial - Communicate between an mbed Microcontroller and a PC
- Back to the Handbook
- Explore the Cookbook
- Some web browsers and download managers will automatically download files to a predefined location. To configure the download location so you can save it to the mbed Microcontroller, see Choose-where-to-save-files-FAQ
- The compiler only supports some web browsers and platforms; see Which-browsers-are-supported-FAQ
- If you have problems using cut and paste functionality (Ctrl+C, Ctrl+V) in IE7, see Cut-and-paste-IE-FAQ
If you have any problems, or think this tutorial could be improved, please tell us in the Forum!