bachelorproef

Dependencies:   mbed C12832

Committer:
jonivdh
Date:
Fri Mar 27 15:27:30 2020 +0000
Revision:
3:df5d91adc3bb
Parent:
0:6c9daa430100
k;

Who changed what in which revision?

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