Simple Debouncing library and sample code.
Dependencies: DebouncedIn mbed
Diff: main.cpp
- Revision:
- 2:e7f390d1e86c
- Parent:
- 1:3f6f29315707
--- 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. } } }