Oscar Schofield / Mbed 2 deprecated Elec350_OBS

Dependencies:   mbed

Revision:
13:4b9c32ba0572
Parent:
12:08a1971c9441
Child:
14:6427883f5900
--- a/button.cpp	Thu Nov 12 12:01:14 2015 +0000
+++ b/button.cpp	Thu Nov 12 12:07:39 2015 +0000
@@ -13,9 +13,6 @@
 
 float Button::getPulse(float timeout)
 {
-    while(this->ifPressed()== false){
-        //DO NADA    
-    }
 
     Timer timer;
     timer.start();
@@ -26,6 +23,10 @@
          }
     }
     
+    while(this->ifPressed() == true){
+        wait(0.01f);
+    }
+    
     timer.stop();
     return timer.read();    
 }
\ No newline at end of file