QUERY · ISSUE
TouchPad Error on ESP32-WROOM32
port-esp32
import network
from machine import Pin, freq, TouchPad
freq(240000000)
network.WLAN().active(False)
t=TouchPad(Pin(32))
while True:
t.read()
This code writes a number like 603... which gets smaller as I get near the wire connected to pin 32.
As I touch it it gives TouchPad Error.
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
ValueError: Touch pad error
If instead I do:
import network
from machine import Pin, freq, ADC
freq(240000000)
network.WLAN().active(False)
adc=ADC(Pin(32))
adc.atten(ADC.ATTN_11DB)
while True:
adc.read()
it's vbery easy to understand even the distance between the finger and the header/wire.
I don't understand why the error.
Also:
I can do the same on Pin(34). TouchPad does not even allow it.. but ADC does.
CANDIDATE · PULL REQUEST
esp32: Fix TouchPad on esp32s2 and esp32s3.
port-esp32
Fixed the issue that TouchPad failed on esp32s2 and esp32s3
after compiling firmware with ESP-IDF v4.4 and higher versions.
Addresses issue #8048 .
Solution proposed by this contributor https://github.com/micropython/micropython/issues/8048#issuecomment-1107432527 .
Tested with this code passed:
from machine import TouchPad, Pin
# ESP32S3 TouchPad on GPIO 1~14
t = TouchPad(Pin(i))
print(t.read())
Specific readings depend on the PCB and its peripherals.