sdsd

Dependencies:   mbed-src mbed

Fork of Serial_HelloWorld_Mbed by mbed official

main.cpp

Committer:
JunaidAshraf
Date:
23 months ago
Revision:
1:6c338020fc53
Parent:
0:879aa9d0247b

File content as of revision 1:6c338020fc53:

#include "mbed.h"
 
DigitalOut led1(LED1);
DigitalOut led2(LED2);
DigitalOut led3(LED3);
 
Serial pc(USBTX, USBRX);
 
void callback() {
    // Note: you need to actually read from the serial to clear the RX interrupt
    printf("%c\n", pc.getc());
    char a=pc.getc();
    led3 = !led3;
    printf("%c\n", a);
    led2 = !led2;
}
 
int main() {
    pc.attach(&callback);
    
    while (1) {
        led1 = !led1;
        wait(0.5);
    }
}