# Counter used to space the input counter = 0 # String used to hold the entered code userEntry = "" # -------------------------------------------Keypad Configuration # Global Variables alarmSoundLocation = "/home/pi/RPHSP/alarm.mp3" # Set Broadcom mode so we can address GPIO pins by number. GPIO.setmode(GPIO.BCM) # Set LCD Settings mylcd = i2c_driver.LCD() mylcd.backlight(1) # Door Sensor class class doorSensor: def __init__(self, name, pin): self.name = name self.pin = pin # Create array of sensors sensors = [] sensors.append(doorSensor("Front Door", 16)) sensors.append(doorSensor("Living Room Window", 26)) sensors.append(doorSensor("Garage Door", 20)) sensors.append(doorSensor("Basement Door", 21))
# We must stop crypto util.deauth() print("") time.sleep(1) # ================================================================== # Main Function # ================================================================== try: # Set the default backlight time and create the lock to be used by the LCD screen backlightTimer = backlightTimerDuration updateLCDLock = threading.Lock() # Initialize LCD object, turn the LCD screen on, create the LCD lock object, and set the backlight timer lcd = i2c_driver.LCD(updateLCDLock) lcd.backlight("On") controlPanelRunning = threading.Thread(target=controlPanel) controlPanelRunning.daemon = True controlPanelRunning.start() backlightCountdownRunning = threading.Thread(target=backlightCountdown) backlightCountdownRunning.daemon = True backlightCountdownRunning.start() rfidReaderRunning = threading.Thread(target=rfidReader) rfidReaderRunning.daemon = True rfidReaderRunning.start() while True: