receive input from terminal to control the leds

Dependencies:   mbed

main.cpp

Committer:
ekasinambela
Date:
2016-05-31
Revision:
0:da915495c7fc

File content as of revision 0:da915495c7fc:

#include "mbed.h"

Serial pc(USBTX, USBRX);
DigitalOut myled1(LED1), myled2(LED2);

int main() {
    
    while(1) {
    char c = pc.getc();
        if (c=='q'){
            myled1 = 1;
            wait(0.2);
            myled1 = 0;
            wait(0.2);    
        }
        
        if (c=='w'){
            myled2 = 1;
            wait(0.2);
            myled2 = 0;
            wait(0.2);    
        }
        
    }
}