Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
ms523
Date:
Thu Feb 09 19:47:30 2012 +0000
Commit message:

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 Feb 09 19:47:30 2012 +0000
@@ -0,0 +1,37 @@
+#include "mbed.h"
+
+Serial rn42(p13,p14);
+Serial pc(USBTX,USBRX);
+DigitalOut myled(LED1);
+
+int main() {
+
+    rn42.baud(115200);
+    pc.baud(115200);
+
+    // echo back characters, toggle the LED
+    while (1) {
+        if (rn42.readable()) {
+            int key = rn42.getc();
+            if(key < 0x20){
+                rn42.printf("\n\r");
+                pc.printf("\n\r");
+            }else{
+                rn42.putc(key);
+                pc.putc(key);
+                myled = !myled;
+            }
+        }
+        if (pc.readable()) {
+            int key = pc.getc();
+            if(key == 0x0D){
+                rn42.printf("\n\r");
+                pc.printf("\n\r");
+            }else{
+                pc.putc(key);
+                rn42.putc(key);
+                myled = !myled;
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Feb 09 19:47:30 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/63bcd7ba4912