In order to read touchpoint, the pins need to be changed from input to output and viceversa. However, once a pin is declared as analog, it can not be fully (re)used as a digital Pin. The set can only be set to 0 and but not to 1. The pin remains analog unless the board is reset. To use the analog pin as digital, the boards needs to be power reset(using the reset button or power off and on). machine.reset does not work.
Code: Select all
>>> from machine import Pin, ADC
>>> pin = Pin(32, Pin.OUT, value=0)
>>> pin.value()
0
>>> pin.on()
>>> pin.value()
1
>>> pin = ADC(Pin(32))
>>> pin.read()
0
>>> pin = Pin(32, Pin.OUT, value=0)
>>> pin.value()
0
>>> pin.on()
>>> pin.value()
0
>>> pin.value(1)
>>> pin.value()
0
>>> pin.on()
>>> pin.value()
0
Thanks