Currently a giant piece of crap, this library is just a quick way to get cheap inputs out of scrap parts. I will fix it up eventually so if you decide to use it now you do so at your own risk. Also, if you are allergic to moronic library names you probably do not want to touch this :)

Revision:
1:69d0b1c11c73
Parent:
0:8ab3a8aaf559
Child:
2:cc7e700413d4
--- a/theBadTouch.cpp	Mon Jan 31 00:00:35 2011 +0000
+++ b/theBadTouch.cpp	Mon Jan 31 03:20:18 2011 +0000
@@ -14,6 +14,7 @@
     falseCounter = 0;
     t.start();
     t_off.start();
+    _touchCounter = 0x00;
 }
 
 
@@ -41,9 +42,22 @@
         falseCounter = 0;
         return 0x00;
     }
+    
+    
+    
 
     if(badPlace() >= 1.0)
     {
+        if(_touchCounter < 0x01)
+        {
+            _touchCounter++;
+            return false;
+        }
+        else
+        {
+            _touchCounter = 0x00;
+        }
+        
         if(_untouchedFlag == 0x01)
         {
             _untouchedFlag = 0x00;
@@ -73,40 +87,6 @@
     return 0x00;
 }
 
-bool theBadTouch::oldbadPlace()
-{
-    _precharge = new DigitalInOut(_sensor);
-    _precharge->output();
-    (*_precharge) = 1; 
-    _precharge->input();
-    _precharge->mode(PullNone);
-    delete _precharge;
-    wait_ms(10);
-    _sense = new AnalogIn(_sensor);
-    float value = *_sense;
-    delete _sense;
-
-    if(value >= 1.0)
-    {
-        _touchFlag = 0x01;
-        falseCounter = 0;
-        return true;
-    }
-    else
-    {
-        falseCounter++;
-    }
- 
-    
-    if(falseCounter > 5)
-    {
-        _untouchedFlag = 0x01;
-        falseCounter = 0;
-    }
-    return false;
-}
-
-
 float theBadTouch::badPlace()
 {
     _precharge = new DigitalInOut(_sensor);