Min-Haw Liu
/
Serial_Done
mBed with Arduino
Fork of Serial_2 by
main.cpp
- Committer:
- yu10078999
- Date:
- 2016-08-27
- Revision:
- 0:5d2615cbb0df
- Child:
- 1:7b45959a62d9
File content as of revision 0:5d2615cbb0df:
#include "mbed.h" DigitalOut led(D2); Serial pc(USBTX, USBRX); char val; int main() { pc.baud(9600); while(1) { if(pc.readable()) { pc.printf("Ready\n"); val = pc.getc(); if(val=='a'){ led = 1 ; pc.printf("LED ON\n"); } else if (val == 'b') { led = 0; pc.printf("LED OFF\n"); } } } }