from lcd_pico import *
from keypad_pico import *


setupLCD()
setupKeypad()
displayString(1, 1,"INPUT PASSWORD")


DEFAULT_PASS = "A1B2C3"
DEFAULT_PASS_LEN = 6

input_keys = []

while True:

  while len(input_keys) != DEFAULT_PASS_LEN:
    key = Keypad4x4Read(col_list, row_list)
    if key != None:
      input_keys.append(key)
      # print("Pressed button: " + key) # for debugging
      displayString(2, 4 + len(input_keys), "*")
      utime.sleep(0.3) # prevent debounce

  if "".join(input_keys) == DEFAULT_PASS:
    break
  
  clearScreen()
  displayString(1, 1, "INCORRECT")
  displayString(2, 1, "PASSWORD")
  utime.sleep(2)
  clearScreen()
  displayString(1, 1,"INPUT PASSWORD")
  input_keys = []

 
clearScreen()
displayString(1, 1,"PASSWORD")
displayString(2, 1,"ACCEPTED")
while True:
  continue




 
BOOTSELLED1239USBRaspberryPiPico©2020RP2-8020/21P64M15.00TTT