Browse Source

touch test

main
Hendrik Langer 8 years ago
parent
commit
6d7b1f60b4
  1. 17
      src/main.cpp

17
src/main.cpp

@ -8,7 +8,7 @@
*/ */
#include "Arduino.h" #include "Arduino.h"
#define LED_PIN 5 #define LED_PIN 6
void setup() void setup()
{ {
@ -19,13 +19,20 @@ void setup()
void loop() void loop()
{ {
// turn the LED on (HIGH is the voltage level) // turn the LED on (HIGH is the voltage level)
if ( touchRead(T0) < 50
|| touchRead(T1) < 50
|| touchRead(T2) < 50
|| touchRead(T3) < 50
|| touchRead(T4) < 50
|| touchRead(T5) < 50
|| touchRead(T6) < 50
|| touchRead(T7) < 50
|| touchRead(T8) < 50 ) {
digitalWrite(LED_PIN, HIGH); digitalWrite(LED_PIN, HIGH);
} else {
// wait for a second
delay(1000);
// turn the LED off by making the voltage LOW // turn the LED off by making the voltage LOW
digitalWrite(LED_PIN, LOW); digitalWrite(LED_PIN, LOW);
}
// wait for a second // wait for a second
delay(1000); delay(1000);

Loading…
Cancel
Save