Play-Doh Touch Buttons
The touch input is a very fleixble way of getting input on the micro:bit. There are so many different ways of doing it. The Play-Doh way is pretty simple.
Here you have the basic code to check for touch input on the 3 large pins. Remember, you have to make contact between the pin and GND to trigger the touch event.
from microbit import * while True: if pin0.is_touched(): display.set_pixel(0,0,9) else: display.set_pixel(0,0,0) if pin1.is_touched(): display.set_pixel(2,0,9) else: display.set_pixel(2,0,0) if pin2.is_touched(): display.set_pixel(4,0,9) else: display.set_pixel(4,0,0) sleep(10)
Here are the Play-Doh buttons in action. I've used an edge connector and jumper wires to make my connections. You could use alligator clips or 4mm banana cables too.
- Clearly, any game you made with plain old buttons needs some nicely deisgned touch inputs to do the job instead.
- Think about where you place the GND lump and the pin lump. You could place them so that the signal is triggered when another conductive object makes contact with both of them. Some imagination and you can do lots of intersting things with the touch input.