Used to create a USB -> Serial link between a PC and a serial device

Dependencies:   mbed

Connect your serial device to p28 (tx) and p27 (rx). Change the baud rate to match your device. The baud rate must be the same for Serial pc and Serial device.

Files at this revision

API Documentation at this revision

Comitter:
joe4465
Date:
Thu Sep 18 08:37:54 2014 +0000
Commit message:
Final version

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	Thu Sep 18 08:37:54 2014 +0000
@@ -0,0 +1,23 @@
+#include "mbed.h"
+
+DigitalOut myled(LED1);
+ 
+Serial pc(USBTX, USBRX); // tx, rx
+Serial device(p28, p27);  // tx, rx
+
+int main() {
+    
+    device.baud(115200);
+    pc.baud(115200);
+ 
+ 
+    while(1) {
+        if(pc.readable()) {
+            device.putc(pc.getc());
+        }
+        if(device.readable()) {
+            myled = !myled;
+            pc.putc(device.getc());
+        }
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Sep 18 08:37:54 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/0b3ab51c8877
\ No newline at end of file