Internal - Touch ESP32¶
Name: Touch ESP32
Used libraries: .
Touch pin support for ESP32.
The ESP32 does have support for 10 touch pads.
Such a touch pad can be as simple as a wire or a PCB pad connected to
one of the GPIO pins labelled with
A touch pad pin can be considered as an analog input pin. When not touched, the reported value is “High”, for example 100.
When touched, the capacity of the pin increases, which in return lowers the number of charge/discharge cycles. A typical value for a touched pin is lower than 20.
The user has to set a threshold value for when to consider a pin being touched. The best value has to be determined by trial and error and may differ per use case.
The regular events like in every other task. Only difference here is that you may have an event either when the touch pad is touched, released or both.
on touch#Touch do GPIO,2,1 //LED on endon
When enabled, this event will be sent on release of the touch pad. The event variable is the time in msec the pad had been touched.
on touch#Duration do LogEntry,'Touch Duration %eventvalue% ms' endon
Example in the log:
6553261 : Info : Touch : ADC2 ch5 (T5): 10 6553338 : Info : EVENT: touch#Touch=10.00 6553638 : Info : EVENT: touch#Duration=460 6553653 : Info : ACT : LogEntry,'Touch Duration 460 ms' 6553654 : Info : Command: LogEntry 6553655 : Info : Touch Duration 460 ms
Changed in version 2.0: …