Guest User

Untitled

a guest
Feb 19th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. #!/usr/bin/env python
  2. import RPi.GPIO as GPIO
  3. import os
  4. GPIO.setwarnings(False)
  5. GPIO.setmode(GPIO.BCM)
  6. GPIO.setup(17, GPIO.IN)
  7. while True:
  8. if GPIO.input(17): # Waits for motion signal from PIR on GPIO pin 17 then complete rest and exit
  9. print ("deactivating screensaver")
  10. os.system("xscreensaver-command -deactivate")
  11.  
  12. #!/usr/bin/env python
  13.  
  14. import RPi.GPIO as GPIO
  15. import os
  16. import time
  17.  
  18. GPIO.setwarnings(False)
  19. GPIO.setmode(GPIO.BCM)
  20. GPIO.setup(17, GPIO.IN)
  21. while True:
  22. if GPIO.input(17): # Waits for motion signal from PIR on GPIO pin 17 then complete rest and exit
  23. print ("deactivating screensaver")
  24. os.system("xscreensaver-command -deactivate")
  25. time.sleep(1) # sleeps for 1 second
Add Comment
Please, Sign In to add comment