Debounce an input pin.
Diff: Debounce.h
- Revision:
- 0:d73a3ab5ce11
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Debounce.h Sat Mar 28 18:36:46 2015 +0000 @@ -0,0 +1,17 @@ +/* michael@ruck.com märz 2015 v0.1*/ +#ifndef MBED_DEBOUNCE_H +#define MBED_DEBOUNCE_H + +#include "mbed.h" + +class Debounce { + public: + Debounce(PinName pin, uint16_t delay, PinMode pull=PullNone); + uint8_t read(); + + private: + uint16_t _delay; + DigitalIn _pin; + Timer _timer; +}; +#endif \ No newline at end of file