touchRead command isn't working on some pins
Posted: Mon Apr 24, 2023 9:15 am
I have created a bit of simple code to test the functionality of the 10 touch pins on the ESP32.
I uploaded this code to two of my ESP32s and have seen I'm getting a constant reading of 1 on T1 and 0 on T2, regardless of whether the pin is being touched. Screenshot below. This happened ON BOTH separate chips, however the general levels on the other pins were different
I'm using the arduino IDE and the touch readings seem to work on the other pins.
Are the pins known for being unstable? Could it be a manufacturer error?
Code: Select all
void setup()
{
Serial.begin(115200);
delay(1000); // give me time to bring up serial monitor
Serial.println("ESP32 Touch Test");
}
void loop()
{
Serial.println("");
Serial.println("");
Serial.print("T0");
Serial.print("\t");
Serial.print("T1");
Serial.print("\t");
Serial.print("T2");
Serial.print("\t");
Serial.print("T3");
Serial.print("\t");
Serial.print("T4");
Serial.print("\t");
Serial.print("T5");
Serial.print("\t");
Serial.print("T6");
Serial.print("\t");
Serial.print("T7");
Serial.print("\t");
Serial.print("T8");
Serial.print("\t");
Serial.println("T9");
for (int i = 0; i < 10; i++){
Serial.print(touchRead(T0));
Serial.print("\t");
Serial.print(touchRead(T1));
Serial.print("\t");
Serial.print(touchRead(T2));
Serial.print("\t");
Serial.print(touchRead(T3));
Serial.print("\t");
Serial.print(touchRead(T4));
Serial.print("\t");
Serial.print(touchRead(T5));
Serial.print("\t");
Serial.print(touchRead(T6));
Serial.print("\t");
Serial.print(touchRead(T7));
Serial.print("\t");
Serial.print(touchRead(T8));
Serial.print("\t");
Serial.println(touchRead(T9));
delay(100);
}
}
I'm using the arduino IDE and the touch readings seem to work on the other pins.
Are the pins known for being unstable? Could it be a manufacturer error?