LPC1768 with mbed OS (5) and RawSerial test

Fork of rtos_basic by Mbed

Committer:
tbotsQ
Date:
Mon Jan 23 09:39:33 2017 +0000
Revision:
11:87d2ef890844
Parent:
10:dc33cd3f4eb9
Initial version

Who changed what in which revision?

UserRevisionLine numberNew contents of line
emilmont 1:491820ee784d 1 #include "mbed.h"
tbotsQ 11:87d2ef890844 2
emilmont 1:491820ee784d 3 DigitalOut led1(LED1);
emilmont 1:491820ee784d 4 DigitalOut led2(LED2);
tbotsQ 11:87d2ef890844 5
tbotsQ 11:87d2ef890844 6 RawSerial pc(USBTX, USBRX);
tbotsQ 11:87d2ef890844 7
tbotsQ 11:87d2ef890844 8 void callback() {
tbotsQ 11:87d2ef890844 9 // Note: you need to actually read from the serial to clear the RX interrupt
tbotsQ 11:87d2ef890844 10 printf("%c\n", pc.getc());
tbotsQ 11:87d2ef890844 11 led2 = !led2;
emilmont 1:491820ee784d 12 }
tbotsQ 11:87d2ef890844 13
emilmont 1:491820ee784d 14 int main() {
tbotsQ 11:87d2ef890844 15 pc.attach(&callback);
tbotsQ 11:87d2ef890844 16
tbotsQ 11:87d2ef890844 17 while (1) {
emilmont 1:491820ee784d 18 led1 = !led1;
mab5449 10:dc33cd3f4eb9 19 wait(0.5);
emilmont 1:491820ee784d 20 }
tbotsQ 11:87d2ef890844 21 }