Blinky example for Mbed OS 6.0
Blinky Mbed OS example
You can build the project with all supported Mbed OS build tools. However, this example project specifically refers to the command-line interface tool Arm Mbed CLI.
(Note: To see a rendered example you can import into the Arm Online Compiler, please see our import quick start.)
- Install Mbed CLI.
- From the command-line, import the example:
mbed import mbed-os-example-blinky
- Change the current directory to where the project was imported.
main() function is the single thread in the application. It toggles the state of a digital output connected to an LED on the board.
Building and running
- Connect a USB cable between the USB port on the board and the host computer.
Run the following command to build the example project and program the microcontroller flash memory:
bash $ mbed compile -m <TARGET> -t <TOOLCHAIN> --flash
Your PC may take a few minutes to compile your code.
The binary is located at
Alternatively, you can manually copy the binary to the board, which you mount on the host computer over USB.
Depending on the target, you can build the example project with the
IAR toolchain. After installing Arm Mbed CLI, run the command below to determine which toolchain supports your target:
$ mbed compile -S
The LED on your target turns on and off every 500 milliseconds.
If you have problems, you can review the documentation for suggestions on what could be wrong and how to fix it.
- Mbed OS Stats API.
- Mbed OS Configuration.
- Mbed OS Serial Communication.
- Mbed OS bare metal.
- Mbed boards.
License and contributions
The software is provided under Apache-2.0 license. Contributions to this project are accepted under the same license. Please see contributing.md for more info.
This project contains code from other projects. The original license text is included in those source files. They must comply with our license guide.