![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Blinky
main.cpp@0:8af8e4ec230d, 2021-02-09 (annotated)
- Committer:
- srdjansimic
- Date:
- Tue Feb 09 20:55:14 2021 +0000
- Revision:
- 0:8af8e4ec230d
blinky 5 test
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
srdjansimic | 0:8af8e4ec230d | 1 | /* mbed Microcontroller Library |
srdjansimic | 0:8af8e4ec230d | 2 | * Copyright (c) 2019 ARM Limited |
srdjansimic | 0:8af8e4ec230d | 3 | * SPDX-License-Identifier: Apache-2.0 |
srdjansimic | 0:8af8e4ec230d | 4 | */ |
srdjansimic | 0:8af8e4ec230d | 5 | |
srdjansimic | 0:8af8e4ec230d | 6 | #include "mbed.h" |
srdjansimic | 0:8af8e4ec230d | 7 | #include "platform/mbed_thread.h" |
srdjansimic | 0:8af8e4ec230d | 8 | |
srdjansimic | 0:8af8e4ec230d | 9 | |
srdjansimic | 0:8af8e4ec230d | 10 | // Blinking rate in milliseconds |
srdjansimic | 0:8af8e4ec230d | 11 | #define BLINKING_RATE_MS 5000 |
srdjansimic | 0:8af8e4ec230d | 12 | |
srdjansimic | 0:8af8e4ec230d | 13 | |
srdjansimic | 0:8af8e4ec230d | 14 | int main() |
srdjansimic | 0:8af8e4ec230d | 15 | { |
srdjansimic | 0:8af8e4ec230d | 16 | // Initialise the digital pin LED1 as an output |
srdjansimic | 0:8af8e4ec230d | 17 | DigitalOut led(LED1); |
srdjansimic | 0:8af8e4ec230d | 18 | |
srdjansimic | 0:8af8e4ec230d | 19 | printf("Starting web program... \r\n"); |
srdjansimic | 0:8af8e4ec230d | 20 | while (true) { |
srdjansimic | 0:8af8e4ec230d | 21 | led = !led; |
srdjansimic | 0:8af8e4ec230d | 22 | thread_sleep_for(2000); |
srdjansimic | 0:8af8e4ec230d | 23 | } |
srdjansimic | 0:8af8e4ec230d | 24 | } |