Table of Contents
Mbed OS 2 and Mbed OS 5
This is the handbook for Mbed OS 2. If you’re working with Mbed OS 5, please see the new handbook.
The following instructions demonstrate how to download the first program to your Microcontroller, and start it running.
1. Save a program binary (.bin) to the mbed Microcontroller¶
Download the appropriate "Hello World!" binary:
- If you are using the older "mbed NXP LPC2368", you'll need HelloWorld_LPC2368.bin
Note: the source code for this program can be seen in the next section, Creating a program
Save the program binary file to your mbed Microcontroller Disk, just like you would with a normal USB disk. The Status LED will flash as the PC writes the file to the Microcontroller disk.
2. Press the Reset Button¶
When the Reset Button in pressed, the newest program on the mbed Microcontroller Disk will be loaded in to the Microcontroller FLASH memory. The Status LED will flash as this happens.
When the program is has been loaded onto the microcontroller, it will then start it running.
3. Hello World!¶
The Microcontroller is now running the program; flashing LED1 forever! If you reset the Microcontroller, or disconnect and reconnect the power, the program will simply restart.
4. To download a different program¶
It is the newest program on the mbed Microcontroller that is run after reset. We can therefore download a new program or overwrite an existing one to update the program that will run.
Make sure you save the file to the mbed Microcontroller!
- You can use your computer's file explorer to to check what is on the Microcontroller, as you would for a normal USB Disk
- If the Status LED did not flash when saving to the Microcontroller, or after resetting the first time, you probably saved it elsewhere!
- Some browsers default to saving files to your "Desktop", so this should be changed; see Choose-where-to-save-files-FAQ
- Some Linux or old Mac PCs don't write data until you "Eject" the drive; see Mounting-with-sync
Don't try and "Open" or "Run" the program files. Always "Save" them to the Microcontroller.
- Some applications (e.g. VLC Media Player) recognise the .bin extension; ignore them!
Make sure you set it running!
- Remember to reset the Microcontroller to start it running after you download a new program
- If the binary downloads to the micro, but nothing happens, make sure you chose the correct board binary
When you unplug the Microcontroller, you may get a "Device Removal" error message; don't worry!
- You can ignore this, but you can also use "Eject" (Mac) or "Safely Remove Hardware" (Windows) to avoid this if you want
If you have any problems, or think this tutorial could be improved, please tell us in the Forum!