Process Data from Serial port and give keyboard shortcut

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
RohanIyengar
Date:
Mon Dec 12 10:47:50 2016 +0000
Commit message:
publish commit

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
diff -r 000000000000 -r 7fe62cc94779 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Dec 12 10:47:50 2016 +0000
@@ -0,0 +1,26 @@
+#include "mbed.h"
+
+Serial pc(USBTX, USBRX);
+DigitalOut myled(LED1);
+
+char buffer[20];
+char hi;
+volatile char curr[20];
+
+int main() {
+    myled = 1;
+    while(1) {
+        wait(.01);
+        if (pc.readable()) {
+            pc.scanf("%s", buffer);
+            //hi = (char) pc.getc();
+            //curr = buffer;
+            pc.printf(buffer);
+            myled = 1;
+        } else {
+            //pc.printf(curr + "\n");
+            myled = 0;
+        }
+        //pc.printf(curr);
+    }
+}
diff -r 000000000000 -r 7fe62cc94779 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Dec 12 10:47:50 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/d75b3fe1f5cb
\ No newline at end of file