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.

Dependencies:   mbed

main.cpp

Committer:
Vekotin
Date:
2014-01-24
Revision:
0:9720755e6762
Child:
1:7ed7d128d225

File content as of revision 0:9720755e6762:

//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);
        
    }
}