This program is designed to act as a serial terminal for interfacing with serial peripherals, such as the ESP8266, that support AT Commands.
Fork of SerialPassthrough by
main.cpp
- Committer:
- mbedAustin
- Date:
- 2015-04-28
- Revision:
- 5:d94d237eea49
- Parent:
- 4:ba9100d52e48
- Child:
- 6:49fb0cbb3314
File content as of revision 5:d94d237eea49:
#include "mbed.h" RawSerial pc(USBTX, USBRX); // computer to mbed board RawSerial esp(D1, D0); // mbed board to target board int main() { pc.baud(115200); esp.baud(9600); wait(0.1); pc.printf("\r\n########### ready ###########\r\n"); esp.printf("AT+RST\r\n"); while(1) { if(pc.readable()) { char c = pc.getc(); //pc.putc(c); // echo character back to computer for sanity esp.putc(c); } if(esp.readable()) { char c = esp.getc(); pc.putc(c); } } }