pin0.is_touched(), does it work?

Questions and discussion about running MicroPython on a micro:bit board.
Target audience: MicroPython users with a micro:bit.
Post Reply
Posts: 164
Joined: Tue Nov 07, 2017 11:45 pm

pin0.is_touched(), does it work?

Post by rhubarbdog » Wed Aug 01, 2018 5:43 am

In the documentation it states that pins 0,1& 2 have an is_touched() method. If you press a finger on pinX and another on ground is_touched() returns True otherwise it returns False. Can any one get this code to work or like me do you need to connect pin0 to ground with a wire.

Code: Select all

from microbit import *

while True:

    if pin0.is_touched():

Posts: 20
Joined: Wed Nov 01, 2017 8:00 pm

Re: pin0.is_touched(), does it work?

Post by Siriushardware » Mon Aug 20, 2018 6:19 pm

In answer to your question, and somewhat to my surprise, I find this works the same way for me as it does for you, that is, I have to provide a resistance path to 0V to get the image to change. If I dampen my thumbs a little and press them to pin0 and GND respectively, then the image changes.

As far as I know the touch pins have a very high value, weak pull up on them - I think it's meant to be that just touching the pin will make it wiggle high and low in sympathy with the mains hum your body is picking up from the surrounding mains wiring, and this will be detected as 'touched', but it does not seem to work that way.

Post Reply