A simple touch sensor that sends a message to computer when it notices touch. I'm using a simple voltage divider with 10k resistor and body impedance.
Diff: main.cpp
- Revision:
- 0:9720755e6762
- Child:
- 1:7ed7d128d225
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Jan 24 14:32:15 2014 +0000 @@ -0,0 +1,21 @@ +//Almighty Vekotin v.1.0 + +#include "mbed.h" + +AnalogIn ain(p16); +Serial pc(USBTX, USBRX); +float input; + +int main() { + while (1){ + + input = ain.read(); //reads input in p16 + //without touch input is HIGH (1) + if (input < 1){ //with touch input changes its value + pc.printf("TOUCH!"); + } + + wait(0.25); + + } +} \ No newline at end of file