![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
s
README.md@0:921e0ef4606b, 2020-02-04 (annotated)
- Committer:
- an3
- Date:
- Tue Feb 04 09:35:55 2020 +0000
- Revision:
- 0:921e0ef4606b
versucht
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
an3 | 0:921e0ef4606b | 1 | ![](./resources/official_armmbed_example_badge.png) |
an3 | 0:921e0ef4606b | 2 | # Blinky Mbed OS example |
an3 | 0:921e0ef4606b | 3 | |
an3 | 0:921e0ef4606b | 4 | The example project is part of the [Arm Mbed OS Official Examples](https://os.mbed.com/code/) and is the [getting started example for Mbed OS](https://os.mbed.com/docs/mbed-os/v5.14/quick-start/index.html). It contains an application that repeatedly blinks an LED on supported [Mbed boards](https://os.mbed.com/platforms/). |
an3 | 0:921e0ef4606b | 5 | |
an3 | 0:921e0ef4606b | 6 | You can build the project with all supported [Mbed OS build tools](https://os.mbed.com/docs/mbed-os/latest/tools/index.html). However, this example project specifically refers to the command-line interface tool [Arm Mbed CLI](https://github.com/ARMmbed/mbed-cli#installing-mbed-cli). |
an3 | 0:921e0ef4606b | 7 | (Note: To see a rendered example you can import into the Arm Online Compiler, please see our [import quick start](https://os.mbed.com/docs/mbed-os/latest/quick-start/online-with-the-online-compiler.html#importing-the-code).) |
an3 | 0:921e0ef4606b | 8 | |
an3 | 0:921e0ef4606b | 9 | 1. [Install Mbed CLI](https://os.mbed.com/docs/mbed-os/latest/quick-start/offline-with-mbed-cli.html). |
an3 | 0:921e0ef4606b | 10 | |
an3 | 0:921e0ef4606b | 11 | 1. Clone this repository on your system, and change the current directory to where the project was cloned: |
an3 | 0:921e0ef4606b | 12 | |
an3 | 0:921e0ef4606b | 13 | ```bash |
an3 | 0:921e0ef4606b | 14 | $ git clone git@github.com:armmbed/mbed-os-example-blinky && cd mbed-os-example-blinky |
an3 | 0:921e0ef4606b | 15 | ``` |
an3 | 0:921e0ef4606b | 16 | |
an3 | 0:921e0ef4606b | 17 | Alternatively, you can download the example project with Arm Mbed CLI using the `import` subcommand: |
an3 | 0:921e0ef4606b | 18 | |
an3 | 0:921e0ef4606b | 19 | ```bash |
an3 | 0:921e0ef4606b | 20 | $ mbed import mbed-os-example-blinky && cd mbed-os-example-blinky |
an3 | 0:921e0ef4606b | 21 | ``` |
an3 | 0:921e0ef4606b | 22 | |
an3 | 0:921e0ef4606b | 23 | |
an3 | 0:921e0ef4606b | 24 | ## Application functionality |
an3 | 0:921e0ef4606b | 25 | |
an3 | 0:921e0ef4606b | 26 | The `main()` function is the single thread in the application. It toggles the state of a digital output connected to an LED on the board. |
an3 | 0:921e0ef4606b | 27 | |
an3 | 0:921e0ef4606b | 28 | ## Building and running |
an3 | 0:921e0ef4606b | 29 | |
an3 | 0:921e0ef4606b | 30 | 1. Connect a USB cable between the USB port on the board and the host computer. |
an3 | 0:921e0ef4606b | 31 | 2. <a name="build_cmd"></a> Run the following command to build the example project and program the microcontroller flash memory: |
an3 | 0:921e0ef4606b | 32 | ```bash |
an3 | 0:921e0ef4606b | 33 | $ mbed compile -m <TARGET> -t <TOOLCHAIN> --flash |
an3 | 0:921e0ef4606b | 34 | ``` |
an3 | 0:921e0ef4606b | 35 | The binary is located at `./BUILD/<TARGET>/<TOOLCHAIN>/mbed-os-example-blinky.bin`. |
an3 | 0:921e0ef4606b | 36 | |
an3 | 0:921e0ef4606b | 37 | Alternatively, you can manually copy the binary to the board, which you mount on the host computer over USB. |
an3 | 0:921e0ef4606b | 38 | |
an3 | 0:921e0ef4606b | 39 | Depending on the target, you can build the example project with the `GCC_ARM`, `ARM` or `IAR` toolchain. After installing Arm Mbed CLI, run the command below to determine which toolchain supports your target: |
an3 | 0:921e0ef4606b | 40 | |
an3 | 0:921e0ef4606b | 41 | ```bash |
an3 | 0:921e0ef4606b | 42 | $ mbed compile -S |
an3 | 0:921e0ef4606b | 43 | ``` |
an3 | 0:921e0ef4606b | 44 | |
an3 | 0:921e0ef4606b | 45 | ## Expected output |
an3 | 0:921e0ef4606b | 46 | The LED on your target turns on and off every 500 milliseconds. |
an3 | 0:921e0ef4606b | 47 | |
an3 | 0:921e0ef4606b | 48 | |
an3 | 0:921e0ef4606b | 49 | ## Troubleshooting |
an3 | 0:921e0ef4606b | 50 | If you have problems, you can review the [documentation](https://os.mbed.com/docs/latest/tutorials/debugging.html) for suggestions on what could be wrong and how to fix it. |
an3 | 0:921e0ef4606b | 51 | |
an3 | 0:921e0ef4606b | 52 | ## Related Links |
an3 | 0:921e0ef4606b | 53 | |
an3 | 0:921e0ef4606b | 54 | * [Mbed OS Stats API](https://os.mbed.com/docs/latest/apis/mbed-statistics.html). |
an3 | 0:921e0ef4606b | 55 | * [Mbed OS Configuration](https://os.mbed.com/docs/latest/reference/configuration.html). |
an3 | 0:921e0ef4606b | 56 | * [Mbed OS Serial Communication](https://os.mbed.com/docs/latest/tutorials/serial-communication.html). |
an3 | 0:921e0ef4606b | 57 | * [Mbed OS bare metal](https://os.mbed.com/docs/mbed-os/latest/reference/mbed-os-bare-metal.html). |
an3 | 0:921e0ef4606b | 58 | * [Mbed boards](https://os.mbed.com/platforms/). |
an3 | 0:921e0ef4606b | 59 | |
an3 | 0:921e0ef4606b | 60 | ### License and contributions |
an3 | 0:921e0ef4606b | 61 | |
an3 | 0:921e0ef4606b | 62 | 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. |
an3 | 0:921e0ef4606b | 63 | |
an3 | 0:921e0ef4606b | 64 | This project contains code from other projects. The original license text is included in those source files. They must comply with our license guide. |