#!/usr/bin/env python3
from gpiozero import MotionSensor
pir = MotionSensor(24)
while True:
pir.wait_for_motion()
print("You moved")
pir.wait_for_no_motion()
#!/usr/bin/env python3
from gpiozero import MotionSensor, LED
pir = MotionSensor(24)
led = LED(20)
while True:
pir.wait_for_motion()
led.on()
pir.wait_for_no_motion()
led.off()