User Tools

Site Tools


esp32:touch

ESP32 touch sensor

you get noise on touchRead:

you must use this code:

void setup() {
  Serial.begin(2000000);
}
 
int touchRead_(int t) {
  int r1 = touchRead(t);
  int r2 = touchRead(t);
  return r1>r2?r1:r2;
}
 
void loop() {
  int t0 = touchRead_(T0);
  int t1 = touchRead_(T1);
  int t2 = touchRead_(T2);
  int t3 = touchRead_(T3);
  int t4 = touchRead_(T4);
  int t5 = touchRead_(T5);
  int t6 = touchRead_(T6);
  int t7 = touchRead_(T7);
  int t8 = touchRead_(T8);
  int t9 = touchRead_(T9);
  Serial.printf("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n",t0,t1,t2,t3,t4,t5,t6,t7,t8,t9); 
}

note: do not use 0 and 1, they do not work for some reason.

esp32/touch.txt · Last modified: by aistis