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:
Workantile 2015-04-22 21:07:21 +00:00
parent 8c43e027f1
commit cc87c28909
2 changed files with 6 additions and 0 deletions

View File

@ -11,6 +11,7 @@ import socket
CONTROLLER = socket.gethostname()
SERVER = "localhost"
RFID_PATH = "/dev/ttyUSB0"
YELLOW_LED = 7
RED_LED = 11
GREEN_LED = 13
DOOR_STRIKE = 15
@ -45,6 +46,7 @@ atexit.register(GPIO.cleanup)
GPIO.setup(DOOR_STRIKE, GPIO.OUT)
GPIO.setup(RED_LED, GPIO.OUT)
GPIO.setup(GREEN_LED, GPIO.OUT)
GPIO.setup(YELLOW_LED, GPIO.OUT)
#Be explicit with what we want
#lowVoltage of 0 is ground
@ -80,10 +82,13 @@ from urllib import request
# Blocks for 5 seconds before resetting the door
def verify_key(key):
GPIO.output(YELLOW_LED, highVoltage);
with request.urlopen(SERVER + ("/%s" % key)) as f:
if f.read().decode() == "OK":
GPIO.output(YELLOW_LED, lowVoltage);
open_door()
time.sleep(5)
GPIO.output(YELLOW_LED, lowVoltage);
close_door()

View File

@ -11,6 +11,7 @@ SERVER = "http://openings.workantile.com/access/" + CONTROLLER
#RFID_PATH = "/dev/ttyUSB0"
# Set Raspberry Pi GPIO pin numbers
YELLOW_LED = 7
RED_LED = 11
GREEN_LED = 13
DOOR_STRIKE = 15