sdsd

Dependencies:   mbed-src mbed

Fork of Serial_HelloWorld_Mbed by mbed official

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 DigitalOut led3(LED3);
00006  
00007 Serial pc(USBTX, USBRX);
00008  
00009 void callback() {
00010     // Note: you need to actually read from the serial to clear the RX interrupt
00011     printf("%c\n", pc.getc());
00012     char a=pc.getc();
00013     led3 = !led3;
00014     printf("%c\n", a);
00015     led2 = !led2;
00016 }
00017  
00018 int main() {
00019     pc.attach(&callback);
00020     
00021     while (1) {
00022         led1 = !led1;
00023         wait(0.5);
00024     }
00025 }