Blink the onboard LED, and Print it's status in Serial

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

main.cpp

Committer:
Ladon
Date:
2018-05-09
Revision:
66:dd8d05fd9f8b
Parent:
29:0b58d21e87d6

File content as of revision 66:dd8d05fd9f8b:

#include "mbed.h"

DigitalOut led1(LED1);
Serial pc(USBTX, USBRX); // tx, rx

// main() runs in its own thread in the OS
int main() {
    while (true) {
        led1 = !led1;
        pc.printf("%sLed %s\n",(led1?"":"\t"),(led1?"ON":"OFF"));
        wait(0.5);
    }
}