From 9021d7c8ebad4bd7599cc518f41ecd310eab6af2 Mon Sep 17 00:00:00 2001 From: Thomas Jensen Date: Thu, 19 Dec 2019 00:55:15 +0100 Subject: [PATCH] updates --- alert-api.py | 11 +++++++---- test.py | 31 +++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 test.py diff --git a/alert-api.py b/alert-api.py index d7b5964..981da1b 100644 --- a/alert-api.py +++ b/alert-api.py @@ -10,12 +10,12 @@ al = Alertmanager("http://prometheus.lan.uctrl.net:9093") colors = { 'red': { - 'io': 1, + 'io': 24, 'steady': True, 'prev': 0 }, 'orange': { - 'io': 2, + 'io': 4, 'steady': True, 'prev': 0 }, @@ -25,12 +25,12 @@ colors = { 'prev': 0 }, 'blue': { - 'io': 4, + 'io': 2, 'steady': True, 'prev': 0 }, 'clear': { - 'io': 5, + 'io': 17, 'steady': False, 'prev': 0 } @@ -46,6 +46,7 @@ boot_seq = ['clear', 'blue', 'green', 'orange', 'red'] for c, v in colors.items(): GPIO.setup(v['io'], GPIO.OUT) + GPIO.output(v['io'], False) def setColor(color, state): @@ -63,7 +64,9 @@ def bootSequence(): setColor(color, False) +time.sleep(1) bootSequence() +time.sleep(1) while True: d = defaultdict(list) diff --git a/test.py b/test.py new file mode 100644 index 0000000..c274a4c --- /dev/null +++ b/test.py @@ -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