AL..ZO / Mbed 2 deprecated Nucleo_read_button

Dependencies:   mbed

Revision:
1:bf9d382dd610
Parent:
0:c9d8fcdda4d0
--- a/main.cpp	Fri Feb 21 12:57:03 2014 +0000
+++ b/main.cpp	Fri May 05 15:40:01 2017 +0000
@@ -4,11 +4,16 @@
 DigitalOut myled(LED1);
  
 int main() {
+  bool old=1;
   while(1) {
-    if (mybutton == 0) { // Button is pressed
+    if (mybutton == 0 && old) { // Button is pressed
       myled = !myled; // Toggle the LED state
-      wait(0.2); // 200 ms
+      old=0;
+      //wait(0.2); // 200 ms
     }
+    if(mybutton && !old)
+    {
+        old=1;
+    }        
   }
 }
- 
\ No newline at end of file