Yang Zhang пре 5 година
родитељ
комит
fc71ddcb73
1 измењених фајлова са 0 додато и 70 уклоњено
  1. 0 70
      alle.py

+ 0 - 70
alle.py

@@ -1,70 +0,0 @@
-import time
-import multiprocessing
-import Adafruit_BBIO.GPIO as GPIO
-import Adafruit_BBIO.PWM as PWM
-
-inPinIR = "P9_12"
-inPinPIR = "P9_23"
-inPinMAG = "P8_7"
-myPWMLAUT = "P8_13"
-outPinROT = "P9_27"
-GPIO.setup(inPinIR, GPIO.IN)
-GPIO.setup(inPinPIR, GPIO.IN)
-GPIO.setup(inPinMAG, GPIO.IN)
-GPIO.setup(outPinROT, GPIO.OUT)
-GPIO.add_event_detect(inPinIR,GPIO.RISING)
-GPIO.add_event_detect(inPinPIR,GPIO.RISING)
-GPIO.add_event_detect(inPinMAG,GPIO.BOTH)
-
-a=1
-
-try:
-    time.sleep(2)
-    while True:
-        if GPIO.event_detected(inPinIR):
-            print("Motion detected from IR Sensor...")
-            for i in range(0,60):
-                PWM.start(myPWMLAUT, 50, 10000)
-                GPIO.output(outPinROT,GPIO.HIGH)
-                time.sleep(0.5)
-                GPIO.output(outPinROT,GPIO.LOW)
-                time.sleep(0.5)
-                PWM.stop(myPWMLAUT)
-            time.sleep(2)
-
-        if GPIO.event_detected(inPinPIR):
-            print("Motion detected from PIR Sensor...")
-            for i in range(0,60):
-                PWM.start(myPWMLAUT, 50, 10000)
-                GPIO.output(outPinROT,GPIO.HIGH)
-                time.sleep(0.5)
-                GPIO.output(outPinROT,GPIO.LOW)
-                time.sleep(0.5)
-                PWM.stop(myPWMLAUT)
-            time.sleep(2)
-
-        if GPIO.event_detected(inPinMAG):
-            if a==0:
-                print("Fenster ist zu---")
-                a=1
-                time.sleep(2)
-                continue
-            if a==1:
-                print("Fenster ist geoeffnet...")
-                a=0
-                print("Motion detected from Magnet Sensor...")
-                for i in range(0,60):
-                    PWM.start(myPWMLAUT, 50, 10000)
-                    GPIO.output(outPinROT,GPIO.HIGH)
-                    time.sleep(0.5)
-                    GPIO.output(outPinROT,GPIO.LOW)
-                    time.sleep(0.5)
-                    PWM.stop(myPWMLAUT)
-                time.sleep(2)
-                continue
-        else:
-            print("...")
-            time.sleep(2)
-except:
-    GPIO.cleanup()
-    PWM.cleanup()