/* * Program by R. Jordan Kreindler * for LED_BUILTIN and touch sensor * * Dupont wire connected to pin D13 (T4) * is used as the touch sensor. * Most ESP32 development boards have * a built in LED */ int valueRead = 9999; // Establish and initialize // variable valueRead #define touchSensorPinNumber T4 void setup() { pinMode(LED_BUILTIN,OUTPUT); // initialize LED_BUILTIN // as an OUTPUT LED } void loop () { valueRead = touchRead(touchSensorPinNumber); Serial.print("Value Read = "); Serial.println(valueRead); if(valueRead < 60) { digitalWrite(LED_BUILTIN, HIGH); } else { digitalWrite(LED_BUILTIN, LOW); } }