diff --git a/gpio_mapping.py b/gpio_mapping.py new file mode 100644 index 0000000..aee9e9b --- /dev/null +++ b/gpio_mapping.py @@ -0,0 +1,30 @@ +import RPi.GPIO as GPIO +GPIO.setmode(GPIO.BCM); + +def checkInput(pin,name): + GPIO.setup(pin, GPIO.IN); + print("Pin {0}; Value {1}; {2}; ".format(pin,GPIO.input(pin),name)); +def output(pin,name): + print("Pin {0}; Name {1};".format(pin,name)); +print('--- Allgemeine Sensoren ---') +checkInput(19,"PIR") +checkInput(26,"DHT11") +print('--- Linetrackingsensoren (Erster Sensor-Fahrtrichtung-Rechts) ---'); +checkInput(21,"IR-LT-1") +checkInput(20,"IR-LT-2") +checkInput(16,"IR-LT-3") +checkInput(12,"IR-LT-4") +print('--- Ultraschall-Abstanssensoren (Erster Sensor-Fahrtrichtung-Rechts) ---'); +output(13,"UA-1-TRIGGER") +checkInput(22,"UA-1-ECHO") +output(6,"UA-2-TRIGGER") +checkInput(27,"UA-2-IN") +output(5,"UA-3-TRIGGER") +checkInput(17,"UA-3-IN") +print('--- Motorenbelegung ---'); +output(18,"A-1A") #Grau +output(23,"A-1B") #Weiss +output(24,"B-1A") #Blau +output(25,"B-1B") #Lila +GPIO.cleanup(); + diff --git a/test/gpio_test.py b/test/gpio_test.py deleted file mode 100644 index 4850519..0000000 --- a/test/gpio_test.py +++ /dev/null @@ -1,9 +0,0 @@ -import RPi.GPIO as GPIO -GPIO.setmode(GPIO.BCM); -pin=0; -while pin<=40: - GPIO.setup(pin, GPIO.IN); - print("Pin {0}; Value {1};".format(pin,GPIO.input(pin))); - pin += 1; -GPIO.cleanup(); - diff --git a/test/pir.py b/test/pir.py index 9a0dae0..c994d7b 100644 --- a/test/pir.py +++ b/test/pir.py @@ -1,7 +1,7 @@ import RPi.GPIO as GPIO import time -SENSOR_PIN = 22 +SENSOR_PIN = 19 GPIO.setmode(GPIO.BCM) GPIO.setup(SENSOR_PIN, GPIO.IN) @@ -14,7 +14,7 @@ try: GPIO.add_event_detect(SENSOR_PIN , GPIO.RISING, callback=mein_callback) while True: - time.sleep(100) + time.sleep(1) except KeyboardInterrupt: print("Beende...") GPIO.cleanup()