A water flow control system using a LCD display, a rotary encoder KY-040 and a YF-S201 water flow sensor. It uses DebounceIn to generate interrupts from rotary encoder signal.
Dependencies: mbed DebounceIn TextLCD
Diff: main.cpp
- Revision:
- 0:3588368c5b3c
- Child:
- 1:766cbce5e5b7
--- /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); + } +}