Min-Haw Liu
/
Serial_Done
mBed with Arduino
Fork of Serial_2 by
Diff: main.cpp
- Revision:
- 1:7b45959a62d9
- Parent:
- 0:5d2615cbb0df
diff -r 5d2615cbb0df -r 7b45959a62d9 main.cpp --- a/main.cpp Sat Aug 27 11:22:23 2016 +0000 +++ b/main.cpp Sun Sep 04 03:41:20 2016 +0000 @@ -1,20 +1,27 @@ #include "mbed.h" -DigitalOut led(D2); -Serial pc(USBTX, USBRX); + +#define esp8266 pc +DigitalOut led_extern(PB_15); +DigitalOut led(LED1); +//Serial pc(USBTX, USBRX); +Serial esp8266(PB_6, PB_7); char val; int main() { - pc.baud(9600); + pc.baud(115200); + //esp8266(115200); while(1) { if(pc.readable()) { - pc.printf("Ready\n"); + //pc.printf("Ready\n"); val = pc.getc(); if(val=='a'){ led = 1 ; - pc.printf("LED ON\n"); + led_extern = 1; + //pc.printf("LED ON\n"); } else if (val == 'b') { led = 0; - pc.printf("LED OFF\n"); + led_extern = 0; + //pc.printf("LED OFF\n"); } } }