safwan092

Untitled

May 31st, 2023
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. from gpiozero import LED
  2. from gpiozero import Button
  3. import time
  4.  
  5. led = LED(17)
  6. button = Button(27)
  7.  
  8. while True:
  9. print("waiting for button press...")
  10. button.wait_for_press()
  11. print("button is pressed")
  12. led.on()
  13. time.sleep(2)
  14. button.wait_for_release()
  15. print("button is released")
  16. led.off()
  17.  
Advertisement
Add Comment
Please, Sign In to add comment