I have a project that is using a lot of digital IO, I have read in many places I can also use the 3 ADC inputs as digital inputs BUT my Python code doesn't like what I am doing. All other digital pins are fine but the 3 ADC pins all throw the same error:
I have written:
OSwitch = Pin(31, Pin.IN) # Configure pin 31 as input
Thonny says:
MPY: soft reboot
Traceback (most recent call last):
File "<stdin>", line 25, in <module>
ValueError: invalid pin
What do I need to do to allow the use of an ADC pin as a digital pin?
Many thanks
Mike
I have written:
OSwitch = Pin(31, Pin.IN) # Configure pin 31 as input
Thonny says:
MPY: soft reboot
Traceback (most recent call last):
File "<stdin>", line 25, in <module>
ValueError: invalid pin
What do I need to do to allow the use of an ADC pin as a digital pin?
Many thanks
Mike
Statistics: Posted by MikeyStroud — Sun Jan 25, 2026 7:00 pm — Replies 4 — Views 23