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 :)
theBadTouch.h@5:e1e14d61dd00, 2011-02-03 (annotated)
- Committer:
- Nakor
- Date:
- Thu Feb 03 19:58:19 2011 +0000
- Revision:
- 5:e1e14d61dd00
- Parent:
- 1:69d0b1c11c73
Who changed what in which revision?
User | Revision | Line number | New 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 | float badPlace(); |
Nakor | 0:8ab3a8aaf559 | 26 | char isTouch(); |
Nakor | 0:8ab3a8aaf559 | 27 | |
Nakor | 0:8ab3a8aaf559 | 28 | protected: |
Nakor | 0:8ab3a8aaf559 | 29 | DigitalIn * _sink; |
Nakor | 0:8ab3a8aaf559 | 30 | DigitalInOut * _precharge; |
Nakor | 0:8ab3a8aaf559 | 31 | AnalogIn * _sense; |
Nakor | 0:8ab3a8aaf559 | 32 | PinName _sensor; |
Nakor | 0:8ab3a8aaf559 | 33 | bool tracker1, tracker2; |
Nakor | 0:8ab3a8aaf559 | 34 | Timer t, t_off; |
Nakor | 0:8ab3a8aaf559 | 35 | char _touchFlag, _untouchedFlag; |
Nakor | 0:8ab3a8aaf559 | 36 | int falseCounter; |
Nakor | 1:69d0b1c11c73 | 37 | char _touchCounter; |
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 |