Browse Source

'Magnet_01.py' löschen

Yang Zhang 4 years ago
parent
commit
21f7c1296f
1 changed files with 0 additions and 38 deletions
  1. 0 38
      Magnet_01.py

+ 0 - 38
Magnet_01.py

@@ -1,38 +0,0 @@
-import time
-import Adafruit_BBIO.GPIO as GPIO
-
-GPIO.setup("P9_15",GPIO.OUT)
-inPin = "P8_7"
-GPIO.setup(inPin, GPIO.IN)
-GPIO.add_event_detect(inPin,GPIO.BOTH)
-a=1
-
-
-try:
-        time.sleep(2)
-        while True:
-                if GPIO.event_detected(inPin):
-                       #GPIO.output("P9_15",GPIO.HIGH)
-                       #time.sleep(0.5)
-                       #GPIO.output("P9_15",GPIO.LOW)
-                       if a==0:
-                           print("Fenster ist zu---")
-                           a=1
-                           time.sleep(1)
-                           continue
-                       if a==1:
-                           print("Fenster ist geoeffnet...")
-                           GPIO.output("P9_15",GPIO.HIGH)
-                           time.sleep(0.5)
-                           GPIO.output("P9_15",GPIO.LOW)
-                           a=0
-                           #print("Motion detected...")
-                           time.sleep(1)
-                           continue
-
-                else:
-                       print("...")
-                       print(a)
-                       time.sleep(1)
-except:
-       GPIO.cleanup()