Hi, I’m writing my first MicroPython script on my Pico 2 using Pico Explorer. I want a function that advances the code when any button is pressed. Here is what I am using
from pimoroni import Button
tl = Button(12) # Top Left / Button A
tr = Button(14) # Top Right / Button X
bl = Button(13) # Bottom Left / Button B
br = Button(15) # Bottom Right / Button Y
if tl.read() or tr.read() or bl.read() or br.read():
# my code
However, even if all of these are separate if/elif statements, without any being pressed, the code moves on and runs # my code anyways
Why are the ABXY buttons registering without being pressed? Issue also occurs with .is_pressed()
I’ve tried
print(str(tl.read()))
and it returns True, however if I do
if tl.read() == False:
it still doesn’t work when pressed