diff --git a/l2.py b/l2.py deleted file mode 100644 index 74ac1d23372bb4b6e74a9b52a1dfc624eec9e714..0000000000000000000000000000000000000000 --- a/l2.py +++ /dev/null @@ -1,71 +0,0 @@ - -import RPi.GPIO as GPIO -import os, time -from multiprocessing import Process - -RECEIVER_PIN = 23 -RECEIVER_PIN2 = 25 -def callback_func(channel): - if GPIO.input(channel): - print("Lichtschranke 1 wurde unterbrochen {}") - - # alternativ kann ein Script / Shell Befehl gestartet werden - # os.system("ls") -def callback_func2(channel): - if GPIO.input(channel): - print("Lichtschranke 2 wurde unterbrochen {}") - - # alternativ kann ein Script / Shell Befehl gestartet werden - # os.system("ls") -def light_barrier1_check(): - try: - while True: - time.sleep(1) - if(GPIO.input(23)== GPIO.HIGH): - print("Schranke 1 verbunden") - except: - # Event wieder entfernen mittels: - GPIO.remove_event_detect(RECEIVER_PIN) - -def light_barrier2_check(): - try: - while True: - time.sleep(1) - if(GPIO.input(25) == GPIO.HIGH): - print("Schranke 2 verbunden") - except: - # Event wieder entfernen mittels: - GPIO.remove_event_detect(RECEIVER_PIN2) -def light_barrier3_check(i): - - while(GPIO.input(25) == GPIO.HIGH): - if(i==1): - i = 0 - print(i) - #print("Schranke verbunden") - time.sleep(3) - print("Schranke unterbrochen") - i = 1 - - - -if __name__ == '__main__': - GPIO.setmode(GPIO.BCM) - GPIO.setwarnings(False) - - #GPIO.setup(RECEIVER_PIN, GPIO.IN) - GPIO.setup(RECEIVER_PIN2, GPIO.IN) - #GPIO.add_event_detect(RECEIVER_PIN, GPIO.RISING, callback=callback_func, bouncetime=200) - #GPIO.add_event_detect(RECEIVER_PIN2, GPIO.RISING, callback=callback_func2, bouncetime=200) - #light_barrier1_check() - i = 0 - while True: - light_barrier3_check(i) - #light_barrier2_check() - #p1 = Process(target=light_barrier1_check) - #p1.start() - #p2 = Process(target=light_barrier2_check) - #p2.start() - #p1.join() - #p2.join() - diff --git a/light.py b/light.py deleted file mode 100644 index 8de3c59ce9acc3ec043e7952f9abafdfb367701b..0000000000000000000000000000000000000000 --- a/light.py +++ /dev/null @@ -1,22 +0,0 @@ -import RPi.GPIO as GPIO -import time - -GPIO.setmode(GPIO.BCM) - -GPIO.setup(23, GPIO.OUT) -GPIO.setup(24, GPIO.IN) - -for i in range(5): - GPIO.output(23, GPIO.HIGH) - time.sleep(0.5) - GPIO.output(23, GPIO.LOW) - time.sleep(0.5) - -# Endlosschleife -while True: - if GPIO.input(24) == 0: - # Ausschalten - GPIO.output(23, GPIO.LOW) - else: - # Einschalten - GPIO.output(23, GPIO.HIGH) \ No newline at end of file diff --git a/big.py b/light_barrier.py similarity index 100% rename from big.py rename to light_barrier.py diff --git a/light_sensor.py b/light_sensor.py deleted file mode 100644 index 176d88e906e5d329f041ecb3d4e686acf4e5b321..0000000000000000000000000000000000000000 --- a/light_sensor.py +++ /dev/null @@ -1,54 +0,0 @@ - -import RPi.GPIO as GPIO -import os, time -from multiprocessing import Process - -RECEIVER_PIN = 23 -RECEIVER_PIN2 = 25 -def callback_func(channel): - if GPIO.input(channel): - print("Lichtschranke 1 wurde unterbrochen {}") - - # alternativ kann ein Script / Shell Befehl gestartet werden - # os.system("ls") -def callback_func2(channel): - if GPIO.input(channel): - print("Lichtschranke 2 wurde unterbrochen {}") - - # alternativ kann ein Script / Shell Befehl gestartet werden - # os.system("ls") -def light_barrier1_check(): - try: - while True: - time.sleep(1) - if(GPIO.input(23)== GPIO.HIGH): - print("Schranke 1 verbunden") - except: - # Event wieder entfernen mittels: - GPIO.remove_event_detect(RECEIVER_PIN) - -def light_barrier2_check(): - try: - while True: - time.sleep(1) - if(GPIO.input(25) == GPIO.HIGH): - print("Schranke 2 verbunden") - except: - # Event wieder entfernen mittels: - GPIO.remove_event_detect(RECEIVER_PIN2) - -if __name__ == '__main__': - GPIO.setmode(GPIO.BCM) - GPIO.setwarnings(False) - - GPIO.setup(RECEIVER_PIN, GPIO.IN) - #GPIO.setup(RECEIVER_PIN2, GPIO.IN) - GPIO.add_event_detect(RECEIVER_PIN, GPIO.RISING, callback=callback_func, bouncetime=200) - #GPIO.add_event_detect(RECEIVER_PIN2, GPIO.RISING, callback=callback_func2, bouncetime=200) - light_barrier1_check() - #p1 = Process(target=light_barrier1_check) - #p1.start() - #p2 = Process(target=light_barrier2_check) - #p2.start() - #p1.join() - #p2.join() diff --git a/requestTest.py b/requestTest.py deleted file mode 100644 index 399982f2ddab77554acc1209c9edcad45e16bf9d..0000000000000000000000000000000000000000 --- a/requestTest.py +++ /dev/null @@ -1,17 +0,0 @@ -import requests -from requests.structures import CaseInsensitiveDict -#headers = CaseInsensitiveDict() -#headers["Accept"] = "application/json" -#headers["Content-Type"] = "application/json" -base_path = 'https://192.168.0.94:44378/api/parkingrow' -response = requests.get(base_path, verify=False) -print(response.status_code) -print(response.text) -update_path = 'https://192.168.0.94:44378/api/parkingrow/1' -headers = {"Content-Type": "application/json", "Accept":"application/json"} -data = {"increase":True} -patch_request = requests.patch(update_path, json=data, verify=False) -print(patch_request.status_code) -print(patch_request.text) -#patch_request = requests.patch(base_path + '/1',headers=headers, data={'increasing':True}, verify=False) -#print(patch_request.status_code) \ No newline at end of file diff --git a/thread_light.py b/thread_light.py deleted file mode 100644 index 5ac866a931a9759e827b814d3c0e75917af9a5e4..0000000000000000000000000000000000000000 --- a/thread_light.py +++ /dev/null @@ -1,56 +0,0 @@ - -import RPi.GPIO as GPIO -import os, time, asyncio - - -RECEIVER_PIN = 23 -RECEIVER_PIN2 = 25 -def callback_func(channel): - if GPIO.input(channel): - print("Lichtschranke 1 wurde unterbrochen {}") - - # alternativ kann ein Script / Shell Befehl gestartet werden - # os.system("ls") -def callback_func2(channel): - if GPIO.input(channel): - print("Lichtschranke 2 wurde unterbrochen {}") - - # alternativ kann ein Script / Shell Befehl gestartet werden - # os.system("ls") -async def light_barrier1_check(): - try: - while True: - await asyncio.sleep(1) - if(GPIO.input(23)== GPIO.HIGH): - print("Schranke 1 verbunden") - except: - # Event wieder entfernen mittels: - GPIO.remove_event_detect(RECEIVER_PIN) - -async def light_barrier2_check(): - try: - while True: - await asyncio.sleep(1) - if(GPIO.input(25) == GPIO.HIGH): - print("Schranke 2 verbunden") - except: - # Event wieder entfernen mittels: - GPIO.remove_event_detect(RECEIVER_PIN2) - -async def run_task(): - task1 = asyncio.create_task(light_barrier1_check()) - task2 = asyncio.create_task(light_barrier2_check()) - await task1 - await task2 - -if __name__ == '__main__': - GPIO.setmode(GPIO.BCM) - GPIO.setwarnings(False) - - GPIO.setup(RECEIVER_PIN, GPIO.IN) - GPIO.setup(RECEIVER_PIN2, GPIO.IN) - GPIO.add_event_detect(RECEIVER_PIN, GPIO.RISING, callback=callback_func, bouncetime=200) - GPIO.add_event_detect(RECEIVER_PIN2, GPIO.RISING, callback=callback_func2, bouncetime=200) - - asyncio.run(run_task()) -