switch LED on/off using touch switch

 void setup()

{

 Serial.begin(9600);

 delay(1000);

 Serial.println("ESP32 Touch Test"); 

pinMode(onboard_led, OUTPUT);

)

void loop()

Serial.println(touchRead(TO)); // get value using TO


if(touchRead(TO)<=20)

{

digitalWrite(onboard_led,HIGH);

Serial.println("LED is activated as Touch is detected");

}

else

digitalWrite(onboard_led,LOW);

}


delay(1000);                     // check for touch value after every 1

second.

}

Comments

Popular posts from this blog

Object: To print the table of first 10 numbers.