Advertisement
mack29446

Untitled

Apr 14th, 2019
340
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. #!/usr/bin/python
  2. import RPi.GPIO as GPIO
  3. import time
  4. x = "50"
  5.  
  6. GPIO.setmode(GPIO.BCM)
  7. GPIO.setup(21, GPIO.OUT)
  8.  
  9. # time to sleep between operations in the main loop
  10.  
  11. # main loop
  12. while x == "50":
  13. time.sleep(1)
  14. GPIO.output(21, GPIO.HIGH)
  15. print("on")
  16. time.sleep(1)
  17. GPIO.output(21, GPIO.LOW)
  18. print("off")
  19. # Reset GPIO settings
  20. GPIO.cleanup()
  21.  
  22. # find more information on this script at
  23. # http://youtu.be/oaf_zQcrg7g
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement