fork

Fork of RawSerial_ex_2 by mbed_example

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 
00003 DigitalOut led1(LED1);
00004 DigitalOut led2(LED2);
00005 
00006 Serial pc(USBTX, USBRX);
00007 
00008 void callback_ex() {
00009     // Note: you need to actually read from the serial to clear the RX interrupt
00010     pc.putc(pc.getc());
00011     led2 = !led2;
00012 }
00013 
00014 int main() {
00015     pc.attach(&callback_ex);
00016     
00017     while (1) {
00018         led1 = !led1;
00019         wait(0.5);
00020     }
00021 }