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.
Diff: button.cpp
- Revision:
- 10:8a6ecbf764fa
- Parent:
- 9:a018d7c05dc7
- Child:
- 11:444afcb2f59f
diff -r a018d7c05dc7 -r 8a6ecbf764fa button.cpp
--- a/button.cpp Tue Nov 10 13:06:51 2015 +0000
+++ b/button.cpp Thu Nov 12 11:44:30 2015 +0000
@@ -20,9 +20,11 @@
Timer timer;
timer.start();
- while(this->ifPressed()== true){
- wait(0.01f);
+ while(this->ifPressed()== false){
+ if (timeout != -1.0f && timer.read() > timeout){
+ return -1.0f;
}
+
timer.stop();
return timer.read();
}
\ No newline at end of file