Matteo Zorat / Mbed OS mbed-os-example-mbed5-blinky
Committer:
zoratmat
Date:
Mon Oct 25 12:35:43 2021 +0000
Revision:
0:551ca13362cd
Led Blink;

Who changed what in which revision?

UserRevisionLine numberNew 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 }