Henry Herman
/
touchy_fg_bg
None
touchbutton.h
- Committer:
- henryeherman
- Date:
- 2010-12-01
- Revision:
- 0:6ae7b9747a06
File content as of revision 0:6ae7b9747a06:
#ifndef TOUCHBUTTON_H #define TOUCHBUTTON_H #define NUMSAMP 10 //#define DEBUGTOUCH #define DEBUGTOUCHLED class TouchButton { public: TouchButton(PinName ain, PinName din, PinName dout, float threshold, int debounceTime, char *nm); void setThreshold(float level); void setDebounceTime(int t); bool checkState(); float sample(); void charge(); private: char name[10]; float currentValue; float previousValue; AnalogIn sensor; DigitalIn charger; DigitalOut ground; Timer timer; Timer debounceTimer; float analogThreshold; int timeout_ms; void storeValue(); float difference(); }; #endif