import keypad as key
import lcdi2c as lcd
from utime import sleep
pwd="5678"
sleep(0.1)
print("start")
lcd.strwrite("insert password")
passin=""
while 1:
    a=key.getkey()
    if a!=0:
        print(a)
        if a=='#':
            if passin==pwd:
                lcd.cmdwrite(0xc0)
                lcd.strwrite("correct")
            else:
                lcd.cmdwrite(0xc0)
                lcd.strwrite("wrong")
            passin=""
        elif a=='*':
            lcd.cmdwrite(0x01)
            lcd.strwrite("insert password")
            passin=""  #reset variable 
        else:
            passin+=a
            print(passin)
            lcd.cmdwrite(0xc0)
            lcd.strwrite("           ")
            lcd.cmdwrite(0xc0)
            #lcd.strwrite(passin)   
            for i in passin:
                lcd.strwrite('*')         
            
    sleep(0.3)
    
BOOTSELLED1239USBRaspberryPiPico©2020RP2-8020/21P64M15.00TTT