Sam Beh / Mbed 2 deprecated Serial_Echo

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
pnkpntr
Date:
Wed Sep 26 14:50:55 2018 +0000
Commit message:
Final_Working

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 Sep 26 14:50:55 2018 +0000
@@ -0,0 +1,27 @@
+#include "mbed.h"              
+ 
+Serial pc(USBTX, USBRX);
+DigitalOut    led (LED1);
+
+char cmd[100];
+
+int main() {
+    //pc.baud(19200);
+    pc.baud(921600);
+    //pc.printf("Echoes back to the screen anything you type\n");
+    while(1) {
+        if (pc.readable()>0)
+        {
+            led = 1;
+            pc.scanf("%s",cmd);
+            //pc.putc(pc.getc());
+            led = 0;
+            pc.printf(cmd);
+        }
+        else
+        {
+            //led = !led;
+            wait(0.2);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Sep 26 14:50:55 2018 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/e95d10626187
\ No newline at end of file