![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Basic, HelloWorld, MbedOS example. Built Nucleo_F401RE, with MbedOS v5.15.7.
main.cpp@0:d89b801b8a9d, 2021-05-05 (annotated)
- Committer:
- johnAlexander
- Date:
- Wed May 05 09:11:27 2021 +0000
- Revision:
- 0:d89b801b8a9d
Target to MbedOS v5.15.7.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
johnAlexander | 0:d89b801b8a9d | 1 | /* mbed Microcontroller Library |
johnAlexander | 0:d89b801b8a9d | 2 | * Copyright (c) 2019 ARM Limited |
johnAlexander | 0:d89b801b8a9d | 3 | * SPDX-License-Identifier: Apache-2.0 |
johnAlexander | 0:d89b801b8a9d | 4 | */ |
johnAlexander | 0:d89b801b8a9d | 5 | |
johnAlexander | 0:d89b801b8a9d | 6 | #include "mbed.h" |
johnAlexander | 0:d89b801b8a9d | 7 | #include "platform/mbed_thread.h" |
johnAlexander | 0:d89b801b8a9d | 8 | |
johnAlexander | 0:d89b801b8a9d | 9 | |
johnAlexander | 0:d89b801b8a9d | 10 | // Blinking rate in milliseconds |
johnAlexander | 0:d89b801b8a9d | 11 | #define BLINKING_RATE_MS 500 |
johnAlexander | 0:d89b801b8a9d | 12 | |
johnAlexander | 0:d89b801b8a9d | 13 | |
johnAlexander | 0:d89b801b8a9d | 14 | int main() |
johnAlexander | 0:d89b801b8a9d | 15 | { |
johnAlexander | 0:d89b801b8a9d | 16 | // Initialise the digital pin LED1 as an output |
johnAlexander | 0:d89b801b8a9d | 17 | DigitalOut led(LED1); |
johnAlexander | 0:d89b801b8a9d | 18 | |
johnAlexander | 0:d89b801b8a9d | 19 | while (true) { |
johnAlexander | 0:d89b801b8a9d | 20 | led = !led; |
johnAlexander | 0:d89b801b8a9d | 21 | thread_sleep_for(BLINKING_RATE_MS); |
johnAlexander | 0:d89b801b8a9d | 22 | } |
johnAlexander | 0:d89b801b8a9d | 23 | } |