import helpers import pdb if __name__ == "__main__": rfid = RfidKeypad() authList = helpers.loadAuthList() loop = True while loop: try: rfidKey = rfid.getRfid() if rfidKey: # pdb.set_trace() helpers.logAccess(rfidKey) print rfidKey pin = helpers.getPin(rfid) if (rfidKey and pin): isAuth = helpers.isAuthed(authList,rfidKey,pin) if (isAuth): rfid.openDoorLock() rfidKey = '' else: rfid.flashRed() rfidKey = '' sleep(0.05) except KeyboardInterrupt: loop = False
import helpers import pdb if __name__ == "__main__": rfid = RfidKeypad() authList = helpers.loadAuthList() loop = True while loop: try: rfidKey = rfid.getRfid() if rfidKey: # pdb.set_trace() helpers.logAccess(rfidKey) print rfidKey pin = helpers.getPin(rfid) if (rfidKey and pin): isAuth = helpers.isAuthed(authList, rfidKey, pin) if (isAuth): rfid.openDoorLock() rfidKey = '' else: rfid.flashRed() rfidKey = '' sleep(0.05) except KeyboardInterrupt: loop = False
rfidKey = '' pin1 = '' pin2 = '' pinsMatch = False try: print "Scan RFID" while (rfidKey == ''): rfidKey = rfid.getRfid() sleep(0.2) print "RFID read as: %s\n" % rfidKey while (pinsMatch == False): print "Enter Pin: " pin1 = helpers.getPin(rfid,True) print "Enter Pin Again: " pin2 = helpers.getPin(rfid,True) if pin1 == pin2 and pin1 != '': pinsMatch = True else: print "Pins do not match, try again!" helpers.addAccess(username,rfidKey,pin1) print "User Added" rfid.openDoorLock() except KeyboardInterrupt: pass