I have a simple script I found that I'm using to deactivate xscreensaver via PIR motion sensor. It's using nearly 40% of my CPU when it runs. How can I calm it down?
#!/usr/bin/env python
import RPi.GPIO as GPIO
import os
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.IN)
while True:
if GPIO.input(17): # Waits for motion signal from PIR on GPIO pin 17 then complete rest and exit
print ("deactivating screensaver")
os.system("xscreensaver-command -deactivate")