From cc87c289095805c843e4cf1ab3af0675c03c7e2c Mon Sep 17 00:00:00 2001 From: Workantile Date: Wed, 22 Apr 2015 21:07:21 +0000 Subject: [PATCH] Add a yellow LED This LED is enabled during the time that we are sending network requests. Signed-off-by: Workantile --- doors.py | 5 +++++ doorsrc | 1 + 2 files changed, 6 insertions(+) diff --git a/doors.py b/doors.py index f164d94..f4e18be 100755 --- a/doors.py +++ b/doors.py @@ -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() diff --git a/doorsrc b/doorsrc index 5cf48fe..4db1b53 100644 --- a/doorsrc +++ b/doorsrc @@ -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