fixed some symboles gone wrong from copying
This commit is contained in:
@@ -26,9 +26,9 @@ def set_display(enable):
|
|||||||
|
|
||||||
|
|
||||||
def check_timeout():
|
def check_timeout():
|
||||||
if timer >= TIMEOUT and display:
|
if timer >= TIMEOUT and display:
|
||||||
set_display(False)
|
set_display(False)
|
||||||
elif not display and timer < TIMEOUT:
|
elif not display and timer < TIMEOUT:
|
||||||
set_display(True)
|
set_display(True)
|
||||||
|
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ if __name__ == "__main__":
|
|||||||
GPIO.add_event_detect(PIR_GPIO, GPIO.RISING, callback=motion)
|
GPIO.add_event_detect(PIR_GPIO, GPIO.RISING, callback=motion)
|
||||||
while True:
|
while True:
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
if timer < TIMEOUT:
|
if timer < TIMEOUT:
|
||||||
timer += 1
|
timer += 1
|
||||||
check_timeout()
|
check_timeout()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
|
@@ -9,25 +9,25 @@ GPIO.setmode(GPIO.BOARD)
|
|||||||
PIR_GPIO = 16
|
PIR_GPIO = 16
|
||||||
GPIO.setup(PIR_GPIO,GPIO.IN)
|
GPIO.setup(PIR_GPIO,GPIO.IN)
|
||||||
|
|
||||||
read=0
|
read = 0
|
||||||
wait=0
|
wait = 0
|
||||||
|
|
||||||
try:
|
try:
|
||||||
#PIR auslesen
|
#PIR auslesen
|
||||||
while GPIO.input(PIR_GPIO)==1:
|
while GPIO.input(PIR_GPIO) == 1:
|
||||||
read=0
|
read = 0
|
||||||
|
|
||||||
#Abbruch ctrl+c
|
#Abbruch ctrl+c
|
||||||
while True :
|
while True :
|
||||||
#PIR Status abfragen
|
#PIR Status abfragen
|
||||||
read = GPIO.input(PIR_GPIO)
|
read = GPIO.input(PIR_GPIO)
|
||||||
|
|
||||||
if read==1 and wait==0:
|
if read == 1 and wait == 0:
|
||||||
os.system("vcgencmd display_power 1")
|
os.system("vcgencmd display_power 1")
|
||||||
wait=1
|
wait = 1
|
||||||
|
|
||||||
elif read==0 and wait==1:
|
elif read == 0 and wait == 1:
|
||||||
wait=0
|
wait = 0
|
||||||
|
|
||||||
time.sleep(0.01)
|
time.sleep(0.01)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user