Move RFID comment block
Put it with the RFID loop, to make it obvious where RFID stuff happens. Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
This commit is contained in:
parent
4b3d5282ae
commit
4b8b596ae3
29
doors.py
29
doors.py
|
@ -71,19 +71,6 @@ def close_door():
|
||||||
|
|
||||||
|
|
||||||
import time
|
import time
|
||||||
#python-pyserial package. Not sure we need this. Grabbed based on
|
|
||||||
#http://allenmlabs.blogspot.se/2013/01/raspberry-pi-parallax-rfid-reader.html
|
|
||||||
import serial
|
|
||||||
######################
|
|
||||||
# #
|
|
||||||
# Set up RFID Reader #
|
|
||||||
# #
|
|
||||||
######################
|
|
||||||
|
|
||||||
RFID_SERIAL = serial.Serial(RFID_PATH, 2400, timeout=1)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
from urllib import request
|
from urllib import request
|
||||||
#############################################
|
#############################################
|
||||||
# #
|
# #
|
||||||
|
@ -100,11 +87,23 @@ def verify_key(key):
|
||||||
close_door()
|
close_door()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#python-pyserial package. Not sure we need this. Grabbed based on
|
||||||
|
#http://allenmlabs.blogspot.se/2013/01/raspberry-pi-parallax-rfid-reader.html
|
||||||
|
import serial
|
||||||
|
###################
|
||||||
|
# #
|
||||||
|
# Run RFID Reader #
|
||||||
|
# #
|
||||||
|
###################
|
||||||
|
|
||||||
|
RFID_SERIAL = serial.Serial(RFID_PATH, 2400, timeout=1)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
string = RFID_SERIAL.read(12)
|
string = RFID_SERIAL.read(12)
|
||||||
if len(string) == 0:
|
if len(string) == 0:
|
||||||
print("No tag read")
|
print("No tag read")
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
key = string[1:11] #exclude start x0A and stop x0D bytes
|
key = string[1:11] #exclude start x0A and stop x0D bytes
|
||||||
print(key)
|
print(key)
|
||||||
|
|
Loading…
Reference in New Issue