receive input from terminal to control the leds

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
ekasinambela
Date:
Tue May 31 10:41:47 2016 +0000
Commit message:
receive input from keyboard to control the led

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 da915495c7fc main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue May 31 10:41:47 2016 +0000
@@ -0,0 +1,25 @@
+#include "mbed.h"
+
+Serial pc(USBTX, USBRX);
+DigitalOut myled1(LED1), myled2(LED2);
+
+int main() {
+    
+    while(1) {
+    char c = pc.getc();
+        if (c=='q'){
+            myled1 = 1;
+            wait(0.2);
+            myled1 = 0;
+            wait(0.2);    
+        }
+        
+        if (c=='w'){
+            myled2 = 1;
+            wait(0.2);
+            myled2 = 0;
+            wait(0.2);    
+        }
+        
+    }
+}
diff -r 000000000000 -r da915495c7fc mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue May 31 10:41:47 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/6c34061e7c34
\ No newline at end of file