![](/media/cache/profiles/ibmfp2.jpg.50x50_q85.jpg)
Make a serial bridge from a serial I/O device on mbed to the PC
Diff: main.cpp
- Revision:
- 0:382dfbad4ad1
diff -r 000000000000 -r 382dfbad4ad1 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Nov 05 17:36:32 2014 +0000 @@ -0,0 +1,16 @@ +#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()); + } + } +} +