wobblyhead hg > arduino > Button
diff Button.h @ 1:284066a427c8
added flanks detection
| author | ark |
|---|---|
| date | 2017-01-25 23:12 +0100 |
| parents | 968a3e3eb8ef |
| children | b76b999b88c7 |
line wrap: on
line diff
--- a/Button.h Sun Jan 22 23:39:37 2017 +0100 +++ b/Button.h Wed Jan 25 23:12:16 2017 +0100 @@ -1,6 +1,7 @@ #ifndef Button_h #define Button_h + /** utility class for debouncing a button based on pin state and time. @@ -12,10 +13,14 @@ class Button { public: // stabilised button state - bool isPressed; + bool isOn; // millis() time of last state change unsigned long lastChangeMs; - + // flag, true if state changed to pressed + bool isPressed; + // flag, true if state changed to off + bool isReleased; + /** create an uninitialised Button. setup() must be called after this to make it usable.
