Takuo WATANABE
/
DebounceIn_Demo
A demo program for DebounceIn
Diff: main.cpp
- Revision:
- 0:3588368c5b3c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Dec 20 12:05:24 2015 +0000 @@ -0,0 +1,21 @@ +/** A demo program for DebounceIn + * Takuo WATANABE + * http://mbed.org/users/takuo/code/DebounceIn/ + */ + +#include "mbed.h" +#include "DebounceIn.h" + +int nrise = 0, nfall = 0; +void rise() { nrise++; } +void fall() { nfall++; } + +int main() { + DebounceIn button(p14); + button.rise(rise); + button.fall(fall); + while (true) { + printf("nrise=%d, nfall=%d\n", nrise, nfall); + wait(1); + } +}