Created
December 19, 2012 22:57
-
-
Save reinhrst/4341358 to your computer and use it in GitHub Desktop.
Capacitive touch on electic imp. Just load the code, and touch pin 1!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Checks for touch | |
imp.configure("Touch", [], []); | |
function test() { | |
local cycles = 0; | |
hardware.pin1.configure(DIGITAL_OUT); | |
hardware.pin1.write(1); | |
imp.sleep(0.01); | |
hardware.pin1.configure(DIGITAL_IN); | |
while (hardware.pin1.read() == 1) { | |
cycles++; | |
} | |
server.show("Took " + cycles + " cycles"); | |
imp.wakeup(0.1, test); | |
} | |
test(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can it be triggered if a piece of paper is touched it? Looking for a sensor when I place a piece of paper on it the sensor is triggered. Looked at FRS sensors but they need all of the weight right on the sensor.