Hey, ich habe nach Anleitung aus dem Internet das pir.py script gemacht aber ledier tut sich nix. Ich habe alles versucht. der Pi schaltet nichtmal den Monitor ab. auch der befehln den TV Service zu kontrollieren (/opt/vc/bin/tvservice -s) geht nicht dann kommt nur: bash: /opt/vc/bin/tvservice: cannot execute: required file not found
Mein Script sieht so aus:
Code
#!/usr/bin/env python
import sys
import time
import RPi.GPIO as io
import subprocess
io.setmode(io.BCM)
SHUTOFF_DELAY = 10 # seconds
PIR_PIN = 24 # 18 on the board
LED_PIN = 26 # 37 on the board
def main():
io.setup(PIR_PIN, io.IN)
io.setup(LED_PIN, io.OUT)
turned_off = False
last_motion_time = time.time()
while True:
if io.input(PIR_PIN):
last_motion_time = time.time()
io.output(LED_PIN, io.LOW)
print ".",
sys.stdout.flush()
if turned_off:
turned_off = False
turn_on()
else:
if not turned_off and time.time() > (last_motion_time +
SHUTOFF_DELAY):
turned_off = True
turn_off()
if not turned_off and time.time() > (last_motion_time + 1):
io.output(LED_PIN, io.HIGH)
time.sleep(.1)
def turn_on():
subprocess.call("sh /home/lordicon/Scripte/monitor_on.sh", shell=True)
def turn_off():
subprocess.call("sh /home/lordicon/Scripte/monitor_off.sh", shell=True)
if __name__ == '__main__':
try:
main()
except KeyboardInterrupt:
io.cleanup()
Display More
auf dem Bild meine PinBelegung. Ich verzweifle langsam... kann mir hier jemand sagen was hier falsch ist?
es ist ein Pi 4b 8GB mit RaspiOS Full (incl. GUI) und ein PIR SR-501
Danke schonmal.
LG LordIcon