Grove Starter Kit for mbed - Button

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
lingtien5846
Date:
Tue Feb 24 13:45:20 2015 +0000
Parent:
0:c48d7e51d9c9
Commit message:
Update main.cpp

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r c48d7e51d9c9 -r f93ac9d8770c main.cpp
--- a/main.cpp	Mon Feb 16 10:59:24 2015 +0000
+++ b/main.cpp	Tue Feb 24 13:45:20 2015 +0000
@@ -1,16 +1,17 @@
 #include "mbed.h"
 
-DigitalOut myled(LED1);
+DigitalOut led(LED1);
 DigitalIn button(p21);
 
-int main() {
+int main()
+{
     while(1) {
+        wait(0.1);
         if (button) {
-            myled = 1;
+            led = 1;
+        } else {
+            led = 0;
         }
-        else
-            myled = 0;
-            
-        wait(0.7); // simple debouncing
+        wait(0.4); // simple debouncing
     }
-}
\ No newline at end of file
+}