Created
September 27, 2010 03:55
-
-
Save silasb/598580 to your computer and use it in GitHub Desktop.
This file contains 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
//TOUCH SENSING BETA - LED TURNS ON WHEN LIGHT IS PRESENT | |
//BY: RICARDO DE LEMOS 1/17/2007 | |
int led1 = 13; | |
int cath = 2; // negative | |
int ando = 3; // positive | |
void setup() | |
{ | |
pinMode(led1, OUTPUT); | |
pinMode(cath, OUTPUT); | |
pinMode(ando, OUTPUT); | |
Serial.begin(9600); | |
} | |
void loop() | |
{ | |
//REVERSE BIAS | |
digitalWrite(cath, HIGH); | |
digitalWrite(ando, LOW); | |
//CHARGE LED | |
delay(6); | |
//READ LED CAP | |
pinMode(ando, INPUT); | |
delay(6); | |
//WRITE TO LED | |
if (digitalRead(ando) == LOW) | |
{ | |
digitalWrite(led1,HIGH); | |
Serial.print("ON"); | |
} | |
else | |
{ | |
digitalWrite(led1,LOW); | |
Serial.print("OFF"); | |
} | |
//RESET | |
pinMode(ando, OUTPUT); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment