Min-Haw Liu
/
Serial_Done
mBed with Arduino
Fork of Serial_2 by
main.cpp
- Committer:
- liuminhaw
- Date:
- 2016-09-04
- Revision:
- 1:7b45959a62d9
- Parent:
- 0:5d2615cbb0df
File content as of revision 1:7b45959a62d9:
#include "mbed.h" #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(115200); //esp8266(115200); while(1) { if(pc.readable()) { //pc.printf("Ready\n"); val = pc.getc(); if(val=='a'){ led = 1 ; led_extern = 1; //pc.printf("LED ON\n"); } else if (val == 'b') { led = 0; led_extern = 0; //pc.printf("LED OFF\n"); } } } }