const int touchPin = 4; // Use a touch-capable pin on ESP32 (e.g., GPIO4 is T0)
const int ledPin = 19;
const int threshold = 20;
void setup() {
Serial.begin(115200);
pinMode(ledPin, OUTPUT);
}
void loop() {
int touchValue = touchRead(touchPin);
Serial.print("Touch value: ");
Serial.println(touchValue);
if (touchValue < threshold) {
digitalWrite(ledPin, HIGH);
} else {
digitalWrite(ledPin, LOW);
}
delay(100);
}