![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
b
touchbutton.h
- Committer:
- henryeherman
- Date:
- 2010-12-01
- Revision:
- 0:4841f4169944
File content as of revision 0:4841f4169944:
#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