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

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
4180_1
Date:
Wed Nov 05 17:36:32 2014 +0000
Commit message:
ver 1.0

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /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());
+        }
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Nov 05 17:36:32 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/031413cf7a89
\ No newline at end of file