Make a serial bridge from a serial I/O device on mbed to the PC

Dependencies:   mbed

main.cpp

Committer:
4180_1
Date:
2014-11-05
Revision:
0:382dfbad4ad1

File content as of revision 0:382dfbad4ad1:

#include "mbed.h"
 // Make a serial bridge from a serial I/O device on mbed to the PC
Serial pc(USBTX, USBRX); // tx, rx
Serial device(p13, p14);  // tx, rx
 // Defaults to 9600 baud on each device - use .baud(baudrate) to change
int main() {
    while(1) {
        if(pc.readable()) {
            device.putc(pc.getc());
        }
        if(device.readable()) {
            pc.putc(device.getc());
        }
    }
}