# Import the Button component
from picozero import Button
# Set up Buttons with correct pin numbers
button = Button(18)
# React to button press events
def pressed():
print("Button 1 pressed")
def released():
print("Button 1 released")
button.when_pressed = pressed
button.when_released = released
bug_report My Button doesn't work
-
Do not add
()inbutton.when_pressed = pressed
# Import the Switch component
from picozero import Switch
# Set up Switch with correct pin number
switch = Switch(18)
# React to Switch events
def closed():
print("Switch closed")
def opened():
print("Switch opened")
switch.when_closed = closed
switch.when_opened = opened
bug_report My Switch doesn't work
-
Do not add
()inswitch.when_closed = closed