hi i am new with raspberry pi and i am using the gpiozero library…. Can someone tell me why you have to make a loop after button.when_pressed? For example :
button.when_pressed = onButtonPressed
while True: time.sleep(1)`
I tried this and the when_pressed function did not work:
def loop():
#Button detect
button.when_pressed = onButtonPressed
New contributor
James Farrugia is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.