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:
- 6:49fb0cbb3314
- Parent:
- 5:d94d237eea49
File content as of revision 6:49fb0cbb3314:
#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(115200); 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); } } }