SDL2 audio record test
[mirrors/Programs.git] / arduino / led_touch / led_touch.pde
CommitLineData
a3a3e374
H
1//TOUCH SENSING BETA - LED TURNS ON WHEN LIGHT IS PRESENT
2//BY: RICARDO DE LEMOS 1/17/2007
3int led1 = 13;
4int cath = 2; // negative
5int ando = 3; // positive
6
7void setup()
8 {
9 pinMode(led1, OUTPUT);
10 pinMode(cath, OUTPUT);
11 pinMode(ando, OUTPUT);
12 //Serial.begin(9600);
13 }
14
15int dela = 20;
16int last = HIGH;
17int shine = HIGH;
18
19void loop()
20 {
21 //TURN SENSOR LED ON
22 pinMode(ando, OUTPUT);
23 if(shine) {
24 digitalWrite(cath, LOW);
25 digitalWrite(ando, HIGH);
26 delay(100);
27 }
28
29 //REVERSE BIAS + CHARGE LED
30 digitalWrite(cath, HIGH);
31 digitalWrite(ando, LOW);
32 //delay(dela);
33
34 //READ LED CAP
35 pinMode(ando, INPUT);
36 delay(dela);
37 int state = digitalRead(ando);
38
39 //SWITCH
40 if((state != last) && state == LOW) shine = !shine;
41 last = state;
42
43 //DEBUG LED
44 if(state) {
45 digitalWrite(led1,HIGH);
46 } else {
47 digitalWrite(led1,LOW);
48 }
49 }
50
51
This page took 0.16564 seconds and 4 git commands to generate.