|
@@ -1,98 +0,0 @@
|
|
-import Adafruit_BBIO.GPIO as GPIO
|
|
|
|
-import time
|
|
|
|
-import sys
|
|
|
|
-
|
|
|
|
-pin_r1 = "P8_8"
|
|
|
|
-pin_r2 = "P8_10"
|
|
|
|
-pin_r3 = "P8_12"
|
|
|
|
-pin_r4 = "P8_14"
|
|
|
|
-
|
|
|
|
-pin_c1 = "P8_16"
|
|
|
|
-pin_c2 = "P8_17"
|
|
|
|
-pin_c3 = "P8_18"
|
|
|
|
-
|
|
|
|
-GPIO.setup(pin_r1, GPIO.OUT)
|
|
|
|
-GPIO.setup(pin_r2, GPIO.OUT)
|
|
|
|
-GPIO.setup(pin_r3, GPIO.OUT)
|
|
|
|
-GPIO.setup(pin_r4, GPIO.OUT)
|
|
|
|
-GPIO.setup(pin_c1, GPIO.IN)
|
|
|
|
-GPIO.setup(pin_c2, GPIO.IN)
|
|
|
|
-GPIO.setup(pin_c3, GPIO.IN)
|
|
|
|
-
|
|
|
|
-GPIO.add_event_detect(pin_c1,GPIO.RISING)
|
|
|
|
-GPIO.add_event_detect(pin_c2,GPIO.RISING)
|
|
|
|
-GPIO.add_event_detect(pin_c3,GPIO.RISING)
|
|
|
|
-
|
|
|
|
-try:
|
|
|
|
- time.sleep(1)
|
|
|
|
- print("...")
|
|
|
|
- while True:
|
|
|
|
- time.sleep(1)
|
|
|
|
- # 1. Zeile
|
|
|
|
- GPIO.output(pin_r1, GPIO.HIGH)
|
|
|
|
- GPIO.output(pin_r2, GPIO.LOW)
|
|
|
|
- GPIO.output(pin_r3, GPIO.LOW)
|
|
|
|
- GPIO.output(pin_r4, GPIO.LOW)
|
|
|
|
- if GPIO.input(pin_c1):
|
|
|
|
- print("1")
|
|
|
|
- continue
|
|
|
|
- if GPIO.input(pin_c2):
|
|
|
|
- print("2")
|
|
|
|
- continue
|
|
|
|
- if GPIO.input(pin_c3):
|
|
|
|
- print("3")
|
|
|
|
- continue
|
|
|
|
- time.sleep(0.1)
|
|
|
|
-
|
|
|
|
- #2.Zeile
|
|
|
|
- GPIO.output(pin_r1, GPIO.LOW)
|
|
|
|
- GPIO.output(pin_r2, GPIO.HIGH)
|
|
|
|
- GPIO.output(pin_r3, GPIO.LOW)
|
|
|
|
- GPIO.output(pin_r4, GPIO.LOW)
|
|
|
|
- if GPIO.input(pin_c1):
|
|
|
|
- print("4")
|
|
|
|
- continue
|
|
|
|
- if GPIO.input(pin_c2):
|
|
|
|
- print("5")
|
|
|
|
- continue
|
|
|
|
- if GPIO.input(pin_c3):
|
|
|
|
- print("6")
|
|
|
|
- continue
|
|
|
|
- time.sleep(0.1)
|
|
|
|
-
|
|
|
|
- #3.Zeile
|
|
|
|
- GPIO.output(pin_r1, GPIO.LOW)
|
|
|
|
- GPIO.output(pin_r2, GPIO.LOW)
|
|
|
|
- GPIO.output(pin_r3, GPIO.HIGH)
|
|
|
|
- GPIO.output(pin_r4, GPIO.LOW)
|
|
|
|
- if GPIO.input(pin_c1):
|
|
|
|
- print("7")
|
|
|
|
- continue
|
|
|
|
- if GPIO.input(pin_c2):
|
|
|
|
- print("8")
|
|
|
|
- continue
|
|
|
|
- if GPIO.input(pin_c3):
|
|
|
|
- print("9")
|
|
|
|
- continue
|
|
|
|
- time.sleep(0.1)
|
|
|
|
-
|
|
|
|
- #4.Zeile
|
|
|
|
- GPIO.output(pin_r1, GPIO.LOW)
|
|
|
|
- GPIO.output(pin_r2, GPIO.LOW)
|
|
|
|
- GPIO.output(pin_r3, GPIO.LOW)
|
|
|
|
- GPIO.output(pin_r4, GPIO.HIGH)
|
|
|
|
- if GPIO.input(pin_c1):
|
|
|
|
- print("*")
|
|
|
|
- continue
|
|
|
|
- if GPIO.input(pin_c2):
|
|
|
|
- print("0")
|
|
|
|
- continue
|
|
|
|
- if GPIO.input(pin_c3):
|
|
|
|
- print("#")
|
|
|
|
- continue
|
|
|
|
- time.sleep(1)
|
|
|
|
-
|
|
|
|
-except:
|
|
|
|
-
|
|
|
|
- print("incorrect Eingabe")
|
|
|
|
- GPIO.cleanup()
|
|
|