Program to demonstrate lighting an led via a command line command

Dependencies:   LPS331_I2C

Committer:
bhimebau
Date:
Wed Oct 06 13:29:15 2021 +0000
Revision:
1:48e24393d6d9
Parent:
0:f7d9662c6d11
Added Pressure Stuff

Who changed what in which revision?

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