Other Arduino Codes and Videos by Robojax
/*
* This is the Arduino code for TTP223B Capacitive Touch switch with relay
* the output pen 10 is connected to relay
* by touching the touch pad TTP223B or TTP223N-BA6 the relay will be turned ON
*
* Written by Ahmad Nejrabi for Roboja Video
* Date: Dec 04, 2017, in Ajax, Ontario, Canada
* Permission granted to share this code given that this
* note is kept with the code.
* Disclaimer: this code is "AS IS" and for educational purpose only.
*
*/
int LD = 200; // Loop Delay. Controls how long after release the bulb is ON
void setup() {
Serial.begin(9600);
// out pins
pinMode(10, OUTPUT);// LED for button 1
// input pins
pinMode(2, INPUT);// Button 1 input pin 2
Serial.println("Robojax Test: TTP223B touch");
}
void loop() {
// button 1 action
if(digitalRead(2)){
Serial.println("Button Touched ");
digitalWrite(10, LOW); // Turn the LED ON
delay(LD);
}else{
digitalWrite(10, HIGH);// Turn OFF the LED
}
}// loop
If you found this tutorial helpful, please support me so I can continue creating content like this. support me via PayPal