Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp@0:551ca13362cd, 2021-10-25 (annotated)
- Committer:
- zoratmat
- Date:
- Mon Oct 25 12:35:43 2021 +0000
- Revision:
- 0:551ca13362cd
Led Blink;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
zoratmat | 0:551ca13362cd | 1 | /* mbed Microcontroller Library |
zoratmat | 0:551ca13362cd | 2 | * Copyright (c) 2019 ARM Limited |
zoratmat | 0:551ca13362cd | 3 | * SPDX-License-Identifier: Apache-2.0 |
zoratmat | 0:551ca13362cd | 4 | */ |
zoratmat | 0:551ca13362cd | 5 | |
zoratmat | 0:551ca13362cd | 6 | #include "mbed.h" |
zoratmat | 0:551ca13362cd | 7 | #include "platform/mbed_thread.h" |
zoratmat | 0:551ca13362cd | 8 | |
zoratmat | 0:551ca13362cd | 9 | |
zoratmat | 0:551ca13362cd | 10 | // Blinking rate in milliseconds |
zoratmat | 0:551ca13362cd | 11 | #define BLINKING_RATE_MS 2000 |
zoratmat | 0:551ca13362cd | 12 | |
zoratmat | 0:551ca13362cd | 13 | |
zoratmat | 0:551ca13362cd | 14 | int main() |
zoratmat | 0:551ca13362cd | 15 | { |
zoratmat | 0:551ca13362cd | 16 | // Initialise the digital pin LED1 as an output |
zoratmat | 0:551ca13362cd | 17 | DigitalOut led(LED1); |
zoratmat | 0:551ca13362cd | 18 | |
zoratmat | 0:551ca13362cd | 19 | while (true) { |
zoratmat | 0:551ca13362cd | 20 | led = !led; |
zoratmat | 0:551ca13362cd | 21 | thread_sleep_for(BLINKING_RATE_MS); |
zoratmat | 0:551ca13362cd | 22 | } |
zoratmat | 0:551ca13362cd | 23 | } |