Add a yellow LED
This LED is enabled during the time that we are sending network requests. Signed-off-by: Workantile <maintainers@workantile.com>
This commit is contained in:
parent
8c43e027f1
commit
cc87c28909
5
doors.py
5
doors.py
|
@ -11,6 +11,7 @@ import socket
|
||||||
CONTROLLER = socket.gethostname()
|
CONTROLLER = socket.gethostname()
|
||||||
SERVER = "localhost"
|
SERVER = "localhost"
|
||||||
RFID_PATH = "/dev/ttyUSB0"
|
RFID_PATH = "/dev/ttyUSB0"
|
||||||
|
YELLOW_LED = 7
|
||||||
RED_LED = 11
|
RED_LED = 11
|
||||||
GREEN_LED = 13
|
GREEN_LED = 13
|
||||||
DOOR_STRIKE = 15
|
DOOR_STRIKE = 15
|
||||||
|
@ -45,6 +46,7 @@ atexit.register(GPIO.cleanup)
|
||||||
GPIO.setup(DOOR_STRIKE, GPIO.OUT)
|
GPIO.setup(DOOR_STRIKE, GPIO.OUT)
|
||||||
GPIO.setup(RED_LED, GPIO.OUT)
|
GPIO.setup(RED_LED, GPIO.OUT)
|
||||||
GPIO.setup(GREEN_LED, GPIO.OUT)
|
GPIO.setup(GREEN_LED, GPIO.OUT)
|
||||||
|
GPIO.setup(YELLOW_LED, GPIO.OUT)
|
||||||
|
|
||||||
#Be explicit with what we want
|
#Be explicit with what we want
|
||||||
#lowVoltage of 0 is ground
|
#lowVoltage of 0 is ground
|
||||||
|
@ -80,10 +82,13 @@ from urllib import request
|
||||||
|
|
||||||
# Blocks for 5 seconds before resetting the door
|
# Blocks for 5 seconds before resetting the door
|
||||||
def verify_key(key):
|
def verify_key(key):
|
||||||
|
GPIO.output(YELLOW_LED, highVoltage);
|
||||||
with request.urlopen(SERVER + ("/%s" % key)) as f:
|
with request.urlopen(SERVER + ("/%s" % key)) as f:
|
||||||
if f.read().decode() == "OK":
|
if f.read().decode() == "OK":
|
||||||
|
GPIO.output(YELLOW_LED, lowVoltage);
|
||||||
open_door()
|
open_door()
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
|
GPIO.output(YELLOW_LED, lowVoltage);
|
||||||
close_door()
|
close_door()
|
||||||
|
|
||||||
|
|
||||||
|
|
1
doorsrc
1
doorsrc
|
@ -11,6 +11,7 @@ SERVER = "http://openings.workantile.com/access/" + CONTROLLER
|
||||||
#RFID_PATH = "/dev/ttyUSB0"
|
#RFID_PATH = "/dev/ttyUSB0"
|
||||||
|
|
||||||
# Set Raspberry Pi GPIO pin numbers
|
# Set Raspberry Pi GPIO pin numbers
|
||||||
|
YELLOW_LED = 7
|
||||||
RED_LED = 11
|
RED_LED = 11
|
||||||
GREEN_LED = 13
|
GREEN_LED = 13
|
||||||
DOOR_STRIKE = 15
|
DOOR_STRIKE = 15
|
||||||
|
|
Loading…
Reference in New Issue