None

Dependencies:   mbed

Revision:
0:6ae7b9747a06
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/touchbutton.h	Wed Dec 01 03:28:28 2010 +0000
@@ -0,0 +1,32 @@
+
+#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
\ No newline at end of file