Austin Blackstone / Mbed 2 deprecated SerialDeviceTerminal

Dependencies:   mbed

Fork of SerialPassthrough by Austin Blackstone

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 
00003 RawSerial pc(USBTX, USBRX);    // computer to mbed board
00004 RawSerial esp(D1, D0);         // mbed board to target board
00005 
00006 int
00007 main()
00008 {
00009     pc.baud(115200);
00010     esp.baud(115200);
00011     wait(0.1);
00012     pc.printf("\r\n########### ready ###########\r\n");
00013     esp.printf("AT+RST\r\n");
00014     while(1) {
00015         if(pc.readable()) {
00016             char c = pc.getc();
00017             //pc.putc(c); // echo character back to computer for sanity
00018             esp.putc(c);
00019         }
00020         if(esp.readable()) {
00021             char c = esp.getc();
00022             pc.putc(c);
00023         }
00024     }
00025 }