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 :)

Committer:
Nakor
Date:
Mon Jan 31 00:00:35 2011 +0000
Revision:
0:8ab3a8aaf559
Child:
1:69d0b1c11c73
First commit.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Nakor 0:8ab3a8aaf559 1 /* This is a touch sensing library. If you don't have any buttons lying around but need
Nakor 0:8ab3a8aaf559 2 * user input, you may still have what you need. A few capacitors, resistors, unused pins,
Nakor 0:8ab3a8aaf559 3 * and some wire and you've got yourself some capacitive input.
Nakor 0:8ab3a8aaf559 4 *
Nakor 0:8ab3a8aaf559 5 * This library (theBadTouch) by Aaron Goselin. You are free to do what you like with this,
Nakor 0:8ab3a8aaf559 6 * but please keep credit in place.
Nakor 0:8ab3a8aaf559 7 * 2010 Aaron Goselin.
Nakor 0:8ab3a8aaf559 8 *
Nakor 0:8ab3a8aaf559 9 */
Nakor 0:8ab3a8aaf559 10
Nakor 0:8ab3a8aaf559 11 #ifndef _TOUCHYMCTOUCHERTON_
Nakor 0:8ab3a8aaf559 12 #define _TOUCHYMCTOUCHERTON_
Nakor 0:8ab3a8aaf559 13
Nakor 0:8ab3a8aaf559 14 #include "mbed.h"
Nakor 0:8ab3a8aaf559 15
Nakor 0:8ab3a8aaf559 16
Nakor 0:8ab3a8aaf559 17 class theBadTouch {
Nakor 0:8ab3a8aaf559 18
Nakor 0:8ab3a8aaf559 19 public:
Nakor 0:8ab3a8aaf559 20
Nakor 0:8ab3a8aaf559 21
Nakor 0:8ab3a8aaf559 22 theBadTouch(PinName touchPin, PinName sink);
Nakor 0:8ab3a8aaf559 23
Nakor 0:8ab3a8aaf559 24
Nakor 0:8ab3a8aaf559 25 bool oldbadPlace();
Nakor 0:8ab3a8aaf559 26 float badPlace();
Nakor 0:8ab3a8aaf559 27 char isTouch();
Nakor 0:8ab3a8aaf559 28
Nakor 0:8ab3a8aaf559 29 protected:
Nakor 0:8ab3a8aaf559 30 DigitalIn * _sink;
Nakor 0:8ab3a8aaf559 31 DigitalInOut * _precharge;
Nakor 0:8ab3a8aaf559 32 AnalogIn * _sense;
Nakor 0:8ab3a8aaf559 33 PinName _sensor;
Nakor 0:8ab3a8aaf559 34 bool tracker1, tracker2;
Nakor 0:8ab3a8aaf559 35 Timer t, t_off;
Nakor 0:8ab3a8aaf559 36 char _touchFlag, _untouchedFlag;
Nakor 0:8ab3a8aaf559 37 int falseCounter;
Nakor 0:8ab3a8aaf559 38
Nakor 0:8ab3a8aaf559 39
Nakor 0:8ab3a8aaf559 40
Nakor 0:8ab3a8aaf559 41 };
Nakor 0:8ab3a8aaf559 42
Nakor 0:8ab3a8aaf559 43 #endif