LPC1768 with mbed OS (5) and RawSerial test

Fork of rtos_basic by Mbed

main.cpp

Committer:
tbotsQ
Date:
2017-01-23
Revision:
11:87d2ef890844
Parent:
10:dc33cd3f4eb9

File content as of revision 11:87d2ef890844:

#include "mbed.h"

DigitalOut led1(LED1);
DigitalOut led2(LED2);

RawSerial pc(USBTX, USBRX);

void callback() {
    // Note: you need to actually read from the serial to clear the RX interrupt
    printf("%c\n", pc.getc());
    led2 = !led2;
}

int main() {
    pc.attach(&callback);

    while (1) {
        led1 = !led1;
        wait(0.5);
    }
}