← index #5854Issue #8398
Related · high · value 5.446
QUERY · ISSUE

touchPad on Pin 2 (ESP32)

openby DaveHOnCodeopened 2020-04-01updated 2021-03-21

I have downloaded the actual version of Micropython for the ESP32 and i wanted to use Pin 2 as a touchPin. I can decelerate it as a touchpin like this touchPad = TouchPad(Pin(2))

But I cannot read from that: touchPad.read()

Than I get an error: ValueError: Touch pad error

Have anyone an idea?

CANDIDATE · ISSUE

TouchPad Error on ESP32-WROOM32

openby Zibriopened 2022-03-09updated 2023-10-24
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.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied