Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
touchbutton.h
00001 00002 #ifndef TOUCHBUTTON_H 00003 #define TOUCHBUTTON_H 00004 #define NUMSAMP 10 00005 //#define DEBUGTOUCH 00006 #define DEBUGTOUCHLED 00007 class TouchButton { 00008 00009 public: 00010 TouchButton(PinName ain, PinName din, PinName dout, float threshold, int debounceTime, char *nm); 00011 void setThreshold(float level); 00012 void setDebounceTime(int t); 00013 bool checkState(); 00014 float sample(); 00015 void charge(); 00016 00017 private: 00018 char name[10]; 00019 float currentValue; 00020 float previousValue; 00021 AnalogIn sensor; 00022 DigitalIn charger; 00023 DigitalOut ground; 00024 Timer timer; 00025 Timer debounceTimer; 00026 float analogThreshold; 00027 int timeout_ms; 00028 void storeValue(); 00029 float difference(); 00030 }; 00031 00032 #endif
Generated on Wed Jul 13 2022 17:38:20 by
1.7.2