Simple Debouncing library and sample code.

Dependencies:   DebouncedIn mbed

Files at this revision

API Documentation at this revision

Comitter:
SIT2016
Date:
Tue Jun 14 07:20:02 2016 +0000
Parent:
1:3f6f29315707
Commit message:
Removed manual debonce

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 3f6f29315707 -r e7f390d1e86c main.cpp
--- a/main.cpp	Sun Jun 12 09:17:20 2016 +0000
+++ b/main.cpp	Tue Jun 14 07:20:02 2016 +0000
@@ -7,14 +7,8 @@
 int main() {
     while(1) {
         //using library directly
-        /*if (button.rising()){ //execute only if rising edge detected on the button.
+        if (button.rising()){ //execute only if rising edge detected on the button.
            led = !led;
-        }*/
-        
-        //without library
-        if(button == 0) {   //detecting press
-            led = !led;
-            while(button==0);   //empty while to wait while switch is pressed. hence toggling only once. 
         }
     }
 }