v1

Dependencies:   HCSR04

Committer:
snapo
Date:
Mon Nov 29 13:13:55 2021 +0000
Revision:
0:9da26936fdc0
v1

Who changed what in which revision?

UserRevisionLine numberNew contents of line
snapo 0:9da26936fdc0 1 ![](./resources/official_armmbed_example_badge.png)
snapo 0:9da26936fdc0 2 # Blinky Mbed OS example
snapo 0:9da26936fdc0 3
snapo 0:9da26936fdc0 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/).
snapo 0:9da26936fdc0 5
snapo 0:9da26936fdc0 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).
snapo 0:9da26936fdc0 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).)
snapo 0:9da26936fdc0 8
snapo 0:9da26936fdc0 9 1. [Install Mbed CLI](https://os.mbed.com/docs/mbed-os/latest/quick-start/offline-with-mbed-cli.html).
snapo 0:9da26936fdc0 10
snapo 0:9da26936fdc0 11 1. Clone this repository on your system, and change the current directory to where the project was cloned:
snapo 0:9da26936fdc0 12
snapo 0:9da26936fdc0 13 ```bash
snapo 0:9da26936fdc0 14 $ git clone git@github.com:armmbed/mbed-os-example-blinky && cd mbed-os-example-blinky
snapo 0:9da26936fdc0 15 ```
snapo 0:9da26936fdc0 16
snapo 0:9da26936fdc0 17 Alternatively, you can download the example project with Arm Mbed CLI using the `import` subcommand:
snapo 0:9da26936fdc0 18
snapo 0:9da26936fdc0 19 ```bash
snapo 0:9da26936fdc0 20 $ mbed import mbed-os-example-blinky && cd mbed-os-example-blinky
snapo 0:9da26936fdc0 21 ```
snapo 0:9da26936fdc0 22
snapo 0:9da26936fdc0 23
snapo 0:9da26936fdc0 24 ## Application functionality
snapo 0:9da26936fdc0 25
snapo 0:9da26936fdc0 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.
snapo 0:9da26936fdc0 27
snapo 0:9da26936fdc0 28 ## Building and running
snapo 0:9da26936fdc0 29
snapo 0:9da26936fdc0 30 1. Connect a USB cable between the USB port on the board and the host computer.
snapo 0:9da26936fdc0 31 2. <a name="build_cmd"></a> Run the following command to build the example project and program the microcontroller flash memory:
snapo 0:9da26936fdc0 32 ```bash
snapo 0:9da26936fdc0 33 $ mbed compile -m <TARGET> -t <TOOLCHAIN> --flash
snapo 0:9da26936fdc0 34 ```
snapo 0:9da26936fdc0 35 The binary is located at `./BUILD/<TARGET>/<TOOLCHAIN>/mbed-os-example-blinky.bin`.
snapo 0:9da26936fdc0 36
snapo 0:9da26936fdc0 37 Alternatively, you can manually copy the binary to the board, which you mount on the host computer over USB.
snapo 0:9da26936fdc0 38
snapo 0:9da26936fdc0 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:
snapo 0:9da26936fdc0 40
snapo 0:9da26936fdc0 41 ```bash
snapo 0:9da26936fdc0 42 $ mbed compile -S
snapo 0:9da26936fdc0 43 ```
snapo 0:9da26936fdc0 44
snapo 0:9da26936fdc0 45 ## Expected output
snapo 0:9da26936fdc0 46 The LED on your target turns on and off every 500 milliseconds.
snapo 0:9da26936fdc0 47
snapo 0:9da26936fdc0 48
snapo 0:9da26936fdc0 49 ## Troubleshooting
snapo 0:9da26936fdc0 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.
snapo 0:9da26936fdc0 51
snapo 0:9da26936fdc0 52 ## Related Links
snapo 0:9da26936fdc0 53
snapo 0:9da26936fdc0 54 * [Mbed OS Stats API](https://os.mbed.com/docs/latest/apis/mbed-statistics.html).
snapo 0:9da26936fdc0 55 * [Mbed OS Configuration](https://os.mbed.com/docs/latest/reference/configuration.html).
snapo 0:9da26936fdc0 56 * [Mbed OS Serial Communication](https://os.mbed.com/docs/latest/tutorials/serial-communication.html).
snapo 0:9da26936fdc0 57 * [Mbed OS bare metal](https://os.mbed.com/docs/mbed-os/latest/reference/mbed-os-bare-metal.html).
snapo 0:9da26936fdc0 58 * [Mbed boards](https://os.mbed.com/platforms/).
snapo 0:9da26936fdc0 59
snapo 0:9da26936fdc0 60 ### License and contributions
snapo 0:9da26936fdc0 61
snapo 0:9da26936fdc0 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.
snapo 0:9da26936fdc0 63
snapo 0:9da26936fdc0 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.