import lcd
from adc import adc_button,adc_switches
import time
button = adc_button()
switches = adc_switches()


def main():  # Main program block
    lcd.begin()

    print(switches.read())
    time.sleep(0.5)
    print(switches.read())
    time.sleep(0.5)
    print(button.read())
    time.sleep(0.5)
    print(button.read())
    time.sleep(0.5)
    print(switches.read())
    time.sleep(0.5)
    print(switches.read())
    time.sleep(0.5)

    lcd.clear()
    lcd.waitPage()

    print(switches.read())
    time.sleep(0.5)
    print(switches.read())
    time.sleep(0.5)
    print(button.read())
    time.sleep(0.5)
    print(button.read())
    time.sleep(0.5)
    print(switches.read())
    time.sleep(0.5)
    print(switches.read())
    time.sleep(0.5)

    lcd.clear()
    lcd.welcomePage('Dao Minh An', 'B1509360', 7)

    print(switches.read())
    time.sleep(0.5)
    print(switches.read())
    time.sleep(0.5)
    print(button.read())
    time.sleep(0.5)
    print(button.read())
    time.sleep(0.5)
    print(switches.read())
    time.sleep(0.5)
    print(switches.read())
    time.sleep(0.5)

    lcd.clear()
    lcd.addExtraInfoPage('Dao Minh An', 'B1509360')
    lcd.pointerPos(2, 1)

    print(switches.read())
    time.sleep(0.5)
    print(switches.read())
    time.sleep(0.5)
    print(button.read())
    time.sleep(0.5)
    print(button.read())
    time.sleep(0.5)
    print(switches.read())
    time.sleep(0.5)
    print(switches.read())
    time.sleep(0.5)

    lcd.clear()
    lcd.welcomeTempPage(9)

    print(switches.read())
    time.sleep(0.5)
    print(switches.read())
    time.sleep(0.5)
    print(button.read())
    time.sleep(0.5)
    print(button.read())
    time.sleep(0.5)
    print(switches.read())
    time.sleep(0.5)
    print(switches.read())
    time.sleep(0.5)

    lcd.clear()
    lcd.unknownIDPage()
    lcd.pointerPos(2, 2)

    print(switches.read())
    time.sleep(0.5)
    print(switches.read())
    time.sleep(0.5)
    print(button.read())
    time.sleep(0.5)
    print(button.read())
    time.sleep(0.5)
    print(switches.read())
    time.sleep(0.5)
    print(switches.read())
    time.sleep(0.5)

    lcd.clear()
    lcd.addFingerPage(1)

    print(switches.read())
    time.sleep(0.5)
    print(switches.read())
    time.sleep(0.5)
    print(button.read())
    time.sleep(0.5)
    print(button.read())
    time.sleep(0.5)
    print(switches.read())
    time.sleep(0.5)
    print(switches.read())
    time.sleep(0.5)

    lcd.clear()
    lcd.addFingerSuccessPage()

    print(switches.read())
    time.sleep(0.5)
    print(switches.read())
    time.sleep(0.5)
    print(button.read())
    time.sleep(0.5)
    print(button.read())
    time.sleep(0.5)
    print(switches.read())
    time.sleep(0.5)
    print(switches.read())
    time.sleep(0.5)

    lcd.clear()
    lcd.addFingerFailPage()
    lcd.pointerPos(2, 1)

    print(switches.read())
    time.sleep(0.5)
    print(switches.read())
    time.sleep(0.5)
    print(button.read())
    time.sleep(0.5)
    print(button.read())
    time.sleep(0.5)
    print(switches.read())
    time.sleep(0.5)
    print(switches.read())
    time.sleep(0.5)

    lcd.clear()
    lcd.addRFIDPage()

    print(switches.read())
    time.sleep(0.5)
    print(switches.read())
    time.sleep(0.5)
    print(button.read())
    time.sleep(0.5)
    print(button.read())
    time.sleep(0.5)
    print(switches.read())
    time.sleep(0.5)
    print(switches.read())
    time.sleep(0.5)

    lcd.clear()
    lcd.addRFIDSuccessPage()

    print(switches.read())
    time.sleep(0.5)
    print(switches.read())
    time.sleep(0.5)
    print(button.read())
    time.sleep(0.5)
    print(button.read())
    time.sleep(0.5)
    print(switches.read())
    time.sleep(0.5)
    print(switches.read())
    time.sleep(0.5)

    lcd.clear()
    lcd.addRFIDFailPage()
    lcd.pointerPos(2, 1)

    print(switches.read())
    time.sleep(0.5)
    print(switches.read())
    time.sleep(0.5)
    print(button.read())
    time.sleep(0.5)
    print(button.read())
    time.sleep(0.5)
    print(switches.read())
    time.sleep(0.5)
    print(switches.read())
    time.sleep(0.5)

    lcd.clear()
    lcd.addInfoPage()

    print(switches.read())
    time.sleep(0.5)
    print(switches.read())
    time.sleep(0.5)
    print(button.read())
    time.sleep(0.5)
    print(button.read())
    time.sleep(0.5)
    print(switches.read())
    time.sleep(0.5)
    print(switches.read())
    time.sleep(0.5)

    lcd.clear()
    lcd.mainDatabasePage()
    lcd.pointerPos(3, 2)

    print(switches.read())
    time.sleep(0.5)
    print(switches.read())
    time.sleep(0.5)
    print(button.read())
    time.sleep(0.5)
    print(button.read())
    time.sleep(0.5)
    print(switches.read())
    time.sleep(0.5)
    print(switches.read())
    time.sleep(0.5)

    lcd.pointerPos(3, 3)

    print(switches.read())
    time.sleep(0.5)
    print(switches.read())
    time.sleep(0.5)
    print(button.read())
    time.sleep(0.5)
    print(button.read())
    time.sleep(0.5)
    print(switches.read())
    time.sleep(0.5)
    print(switches.read())
    time.sleep(0.5)

    lcd.clear()
    lcd.exportSuccessPage()

    print(switches.read())
    time.sleep(0.5)
    print(switches.read())
    time.sleep(0.5)
    print(button.read())
    time.sleep(0.5)
    print(button.read())
    time.sleep(0.5)
    print(switches.read())
    time.sleep(0.5)
    print(switches.read())
    time.sleep(0.5)

    lcd.clear()
    lcd.exportFailPage()
    lcd.pointerPos(2, 1)
    time.sleep(3)
    lcd.clear()
    lcd.importPage()
    lcd.pointerPos(2, 1)
    time.sleep(3)
    lcd.clear()
    lcd.importSuccessPage()
    time.sleep(3)
    lcd.clear()
    lcd.importFailPage()
    lcd.pointerPos(2, 1)
    time.sleep(3)
    lcd.clear()
    lcd.mainLockerPage()
    lcd.pointerPos(3, 1)
    time.sleep(3)
    lcd.clear()
    lcd.infoLockerPage('<NAME>', 'B1509360')
    time.sleep(3)
    lcd.clear()
    lcd.infoLockerTempPage()
    time.sleep(3)


if __name__ == '__main__':

    try:
        main()
    except KeyboardInterrupt:
        pass
