Raspberry-Pi/testcode.py

15 lines
317 B
Python

from gpiozero import MotionSensor
from time import sleep
# Das OUT-Kabel steckt an GPIO17
pir = MotionSensor(17)
print("PIR Sensor Test gestartet...")
print("Warte auf Bewegung...")
while True:
pir.wait_for_motion()
print("Bewegung erkannt!")
pir.wait_for_no_motion()
print("Keine Bewegung mehr.")