Buttons

cable

Buttons

cable

cable Wire buttons

A three single colour LEDs are connected to the Raspberry Pi Pico using GP5, GP8, and GP13 each also using the nearest GND pins.
It does not matter which leg you connect to GND.

play_circle stop_circle
# 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.