Controlling an LED using an Arduino Compatible TTP223B Capacitive Touch Sensor.
This project was developed with the intention of replacing the traditional button key. It can be used along with a microcontroller or an arduino. When a capacitive load (such as a human hand) is in close proximity to the sense-pad or touches it, the sensor detects the change in capacitance and activates the switch.
Code:
#define ctsPin 2 int ledPin = 13; void setup() { Serial.begin(9600); pinMode(ledPin, OUTPUT); pinMode(ctsPin, INPUT); } void loop() { int ctsValue = digitalRead(ctsPin); if (ctsValue == HIGH) { digitalWrite(ledPin, HIGH); Serial.println("TOUCHED"); } else { digitalWrite(ledPin,LOW); Serial.println("not touched"); } delay(0.9); }
Connections:
13 of Arduino - Positive terminal of LED
GND - Negative terminal of LED
Video:
Comments
Post a Comment