Hi guys!
I'm really new to Arduino. I bought an Arduino nano V3.0 (not genuine) and, with some other stuff, capacitive touch switches.
Of course I first tried to blink the internal LED on Pin 13, and this worked fine. Then I tried to turn it on and off with a capacitive touch Switch (TTP223):
I connected GND an VCC to the Switch, and I/O to Pin 5 (D2).
Code:
const int ledPin = 13;
const int touchPin = 5;
int val = 0;
void setup() {
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
pinMode(touchPin, INPUT);
}
void loop() {
val = digitalRead(touchPin);
delay(50);
if (val == 1) {
digitalWrite(ledPin, HIGH);
}
else {
digitalWrite(ledPin, LOW);
}
Serial.print(val);
delay(100);
}
When running the program neither the LED, nor the Serial.print changes, when I touch the Sensor. The LED on the Sensor does Light up, indicating it recognizes my finger.
Any Ideas? I'm stuck!
Thanks for your help!