mbed OS Blinky LED HelloWorld

Fork of mbed-os-example-mbed5-blinky by mbed-os-examples

main.cpp

Committer:
cyliang
Date:
2020-09-01
Revision:
67:1885193045fb
Parent:
29:0b58d21e87d6

File content as of revision 67:1885193045fb:

/* mbed Microcontroller Library
 * Copyright (c) 2019 ARM Limited
 * SPDX-License-Identifier: Apache-2.0
 */

#include "mbed.h"


// Blinking rate in milliseconds
#define BLINKING_RATE     500


int main()
{
#ifdef MBED_MAJOR_VERSION
    printf("Mbed OS version %d.%d.%d\r\n\n", MBED_MAJOR_VERSION, MBED_MINOR_VERSION, MBED_PATCH_VERSION);
#endif
    // Initialise the digital pin LED1 as an output
    DigitalOut led(LED1);

    while (true) {
        led = !led;
        ThisThread::sleep_for(BLINKING_RATE);
    }
}