cable Wire buttons
It does not matter which leg you connect to GND.
# Import the Button component
from picozero import Button
from time import sleep
# Set up Buttons with correct pin numbers
button_1 = Button(18)
button_2 = Button(22)
button_3 = Button(28)
# Check button state in a loop
while True:
if button_1.is_pressed:
print("Button 1 is pressed")
sleep(0.1) # small delay
bug_report My Button doesn't work
- Check your connections.
- Check the pin numbers in your code.
- Check that your code is indented correctly.