This commit is contained in:
Thomas Jensen 2019-12-19 00:55:15 +01:00
parent 24683e6507
commit 9021d7c8eb
2 changed files with 38 additions and 4 deletions

View File

@ -10,12 +10,12 @@ al = Alertmanager("http://prometheus.lan.uctrl.net:9093")
colors = { colors = {
'red': { 'red': {
'io': 1, 'io': 24,
'steady': True, 'steady': True,
'prev': 0 'prev': 0
}, },
'orange': { 'orange': {
'io': 2, 'io': 4,
'steady': True, 'steady': True,
'prev': 0 'prev': 0
}, },
@ -25,12 +25,12 @@ colors = {
'prev': 0 'prev': 0
}, },
'blue': { 'blue': {
'io': 4, 'io': 2,
'steady': True, 'steady': True,
'prev': 0 'prev': 0
}, },
'clear': { 'clear': {
'io': 5, 'io': 17,
'steady': False, 'steady': False,
'prev': 0 'prev': 0
} }
@ -46,6 +46,7 @@ boot_seq = ['clear', 'blue', 'green', 'orange', 'red']
for c, v in colors.items(): for c, v in colors.items():
GPIO.setup(v['io'], GPIO.OUT) GPIO.setup(v['io'], GPIO.OUT)
GPIO.output(v['io'], False)
def setColor(color, state): def setColor(color, state):
@ -63,7 +64,9 @@ def bootSequence():
setColor(color, False) setColor(color, False)
time.sleep(1)
bootSequence() bootSequence()
time.sleep(1)
while True: while True:
d = defaultdict(list) d = defaultdict(list)

31
test.py Normal file
View File

@ -0,0 +1,31 @@
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM) # set board mode to Broadcom
red = 24
yellow = 4
green = 3
blue = 2
white = 17
test = green
GPIO.setup(red, GPIO.OUT)
GPIO.setup(yellow, GPIO.OUT)
GPIO.setup(green, GPIO.OUT)
GPIO.setup(blue, GPIO.OUT)
GPIO.setup(white, GPIO.OUT)
GPIO.output(red, 0)
GPIO.output(yellow, 0)
GPIO.output(green, 0)
GPIO.output(blue, 0)
GPIO.output(white, 0)
while True:
GPIO.output(test, 1) # turn on pin 5
time.sleep(1) # wait 1 second
GPIO.output(test, 0) # turn off pin 5
time.sleep(1) # wait 1 second