Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of digitalInPolling_sample by
Diff: main.cpp
- Revision:
- 1:4709af498799
- Parent:
- 0:a66a8cb0012c
- Child:
- 2:cd1fe8c29793
--- a/main.cpp Mon Jan 23 13:53:49 2017 +0000
+++ b/main.cpp Tue Jan 24 18:24:25 2017 +0000
@@ -23,19 +23,19 @@
while (true) {
switch (pos) {
case up :
- if (button == 1) { // now down
+ if (button == 0) { // now down
pressEvent = 1 ; // transition occurred
pos = down ;
}
break ;
case down :
- if (button == 0) { // no longer down
+ if (button == 1) { // no longer down
bcounter = 3 ; // wait four cycles
pos = bounce ;
}
break ;
case bounce :
- if (button == 1) { // down again - button has bounced
+ if (button == 0) { // down again - button has bounced
pos = down ; // no event
} else if (bcounter == 0) {
pos = up ; // delay passed - reset to up
