This is a key Demo for LinkNode

Dependencies:   mbed

Fork of mbed_blinky by Mbed

Files at this revision

API Documentation at this revision

Comitter:
helloqi
Date:
Wed Apr 13 12:19:39 2016 +0000
Parent:
10:3e42ca878d11
Commit message:
This is a key Demo for LinkNode

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 3e42ca878d11 -r 5f81cd29b1e6 main.cpp
--- a/main.cpp	Sun Jan 17 03:25:27 2016 +0000
+++ b/main.cpp	Wed Apr 13 12:19:39 2016 +0000
@@ -1,12 +1,31 @@
 #include "mbed.h"
 
-DigitalOut myled(LED1);
+DigitalIn key1(P0_28);
+DigitalIn key2(P0_29);
+
+DigitalOut led1(P0_19);
+DigitalOut led2(P0_20);
+
 
-int main() {
-    while(1) {
-        myled = 1;
-        wait(0.2);
-        myled = 0;
-        wait(0.2);
+int main() 
+{
+    led1=1;
+    led2=1;
+    while(1)
+    {
+        if (key1==0) 
+        {
+            wait(0.010);
+            if(key1==0) 
+                led1=0;  
+        }
+        else led1 = 1;
+        if(key2==0)
+        {
+            wait(0.010);
+            if(key2==0)
+                led2=0;    
+        }
+        else led2 = 1;
     }
 }