import keypad as key
import lcdi2c as lcd
from utime import sleep
password="123456"
temp_pass=""
count=0
sleep(0.01)
lcd.str_wrt("    welcome")
while 1:
    a=key.getkey()
    if a!=0: #only run when keypad pressed
        if a=="*":
            lcd.cmd_wrt(0x01)
            temp_pass="" #clear input password
            count=0
        else:
            lcd.cmd_wrt(0xc5)
            temp_pass+=a 
            count+=1           
            for i in temp_pass:
                lcd.str_wrt("*")                
            print(temp_pass)
        if count==len(password):
            lcd.cmd_wrt(0x01)
            lcd.cmd_wrt(0x85)
            if password==temp_pass:
                lcd.str_wrt("correct")
            else:
                lcd.str_wrt("false")
            temp_pass=""
            count=0


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