John Alexander
/
mbed-os-example-mbed6-blinky
Initial trial for integration with mbed studio.
main.cpp@0:0d3532080d4f, 2020-10-08 (annotated)
- Committer:
- johnAlexander
- Date:
- Thu Oct 08 15:25:12 2020 +0000
- Revision:
- 0:0d3532080d4f
initial release, for trial with mbed studio
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
johnAlexander | 0:0d3532080d4f | 1 | /* mbed Microcontroller Library |
johnAlexander | 0:0d3532080d4f | 2 | * Copyright (c) 2019 ARM Limited |
johnAlexander | 0:0d3532080d4f | 3 | * SPDX-License-Identifier: Apache-2.0 |
johnAlexander | 0:0d3532080d4f | 4 | */ |
johnAlexander | 0:0d3532080d4f | 5 | |
johnAlexander | 0:0d3532080d4f | 6 | #include "mbed.h" |
johnAlexander | 0:0d3532080d4f | 7 | #include "platform/mbed_thread.h" |
johnAlexander | 0:0d3532080d4f | 8 | |
johnAlexander | 0:0d3532080d4f | 9 | |
johnAlexander | 0:0d3532080d4f | 10 | // Blinking rate in milliseconds |
johnAlexander | 0:0d3532080d4f | 11 | #define BLINKING_RATE_MS 500 |
johnAlexander | 0:0d3532080d4f | 12 | |
johnAlexander | 0:0d3532080d4f | 13 | |
johnAlexander | 0:0d3532080d4f | 14 | int main() |
johnAlexander | 0:0d3532080d4f | 15 | { |
johnAlexander | 0:0d3532080d4f | 16 | // Initialise the digital pin LED1 as an output |
johnAlexander | 0:0d3532080d4f | 17 | DigitalOut led(LED1); |
johnAlexander | 0:0d3532080d4f | 18 | |
johnAlexander | 0:0d3532080d4f | 19 | while (true) { |
johnAlexander | 0:0d3532080d4f | 20 | led = !led; |
johnAlexander | 0:0d3532080d4f | 21 | thread_sleep_for(BLINKING_RATE_MS); |
johnAlexander | 0:0d3532080d4f | 22 | } |
johnAlexander | 0:0d3532080d4f | 23 | } |