diff --git a/Relays/script.py b/Relays/script.py new file mode 100644 index 0000000..e82b7d4 --- /dev/null +++ b/Relays/script.py @@ -0,0 +1,35 @@ +import RPi.GPIO as GPIO + + +PUSH = [ +21, #1 +20, #2 +16, #3 +26 #4 +] + + +RELAYS = [ +[], #1 +[], #2 +[], #3 +[] #4 +] + +# Initialize +GPIO.setmode(GPIO.BCM) + +# Push buttons +for i in PUSH: + print("Init push button: " + str(i)) + GPIO.setup(i, GPIO.IN, pull_up_down=GPIO.PUD_UP) + + + +# Infinite loop +while True: + + for num in range(0, len(PUSH)): + + if GPIO.input(PUSH[num]) == False: + print("Button " + str(num) + " pressed")