ESP32 Touch pin

from https://randomnerdtutorials.com/esp32-touch-pins-arduino-ide/


Take a look at your board pinout to locate the 10 different touch sensors – the touch sensitive pins are highlighted in pink color.
ESP32 Touch Sensitive Pins GPIOs


Let’s see how that function works by using an example from the library. In the Arduino IDE, go to File > Examples > ESP32 > Touch and open the TouchRead sketch.
// ESP32 Touch Test
// Just test touch pin - Touch0 is T0 which is on GPIO 4.

void setup() {
  Serial.begin(115200);
  delay(1000); // give me time to bring up serial monitor
  Serial.println("ESP32 Touch Test");
}

void loop() {
  Serial.println(touchRead(4));  // get value of Touch 0 pin = GPIO 4
  delay(1000);
}



留言

熱門文章