
demo test
main.cpp@0:db0f02698665, 2022-11-15 (annotated)
- Committer:
- sunnylu
- Date:
- Tue Nov 15 09:09:52 2022 +0000
- Revision:
- 0:db0f02698665
test
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sunnylu | 0:db0f02698665 | 1 | /* mbed Microcontroller Library |
sunnylu | 0:db0f02698665 | 2 | * Copyright (c) 2019 ARM Limited |
sunnylu | 0:db0f02698665 | 3 | * SPDX-License-Identifier: Apache-2.0 |
sunnylu | 0:db0f02698665 | 4 | */ |
sunnylu | 0:db0f02698665 | 5 | |
sunnylu | 0:db0f02698665 | 6 | #include "mbed.h" |
sunnylu | 0:db0f02698665 | 7 | #include "platform/mbed_thread.h" |
sunnylu | 0:db0f02698665 | 8 | |
sunnylu | 0:db0f02698665 | 9 | |
sunnylu | 0:db0f02698665 | 10 | // Blinking rate in milliseconds |
sunnylu | 0:db0f02698665 | 11 | #define BLINKING_RATE_MS 500 |
sunnylu | 0:db0f02698665 | 12 | |
sunnylu | 0:db0f02698665 | 13 | // SunnyLu test 20221115 |
sunnylu | 0:db0f02698665 | 14 | |
sunnylu | 0:db0f02698665 | 15 | int main() |
sunnylu | 0:db0f02698665 | 16 | { |
sunnylu | 0:db0f02698665 | 17 | // Initialise the digital pin LED1 as an output |
sunnylu | 0:db0f02698665 | 18 | DigitalOut led(LED1); |
sunnylu | 0:db0f02698665 | 19 | |
sunnylu | 0:db0f02698665 | 20 | while (true) { |
sunnylu | 0:db0f02698665 | 21 | led = !led; |
sunnylu | 0:db0f02698665 | 22 | thread_sleep_for(BLINKING_RATE_MS); |
sunnylu | 0:db0f02698665 | 23 | } |
sunnylu | 0:db0f02698665 | 24 | } |