from lcd8bit import*
from keypad import*


password="12345678" #set password
pass_temp=''  # buffer for key in password
print_lcd("start")
while 1:
    key=getkey() # read from keypad
    if key!=0:  # if key is press
        print("key press is:",key)
        if key=='C':
            cmdwrt(0x01)
            pass_temp=''
        elif key=='D':
            if pass_temp==password:
                cmdwrt(0x01)
                cmdwrt(0xc0)
                print_lcd('correct pass')
            else:
                cmdwrt(0x01)
                cmdwrt(0xc0)
                print_lcd('wrong pass')
            pass_temp='' #clear password buffer
        else:
            pass_temp+=key #add key to pass_temp
            print('pass_temp:',pass_temp)
            cmdwrt(0x01)
            cmdwrt(0x80)
            print('pass:',pass_temp)
            for k in pass_temp:
                print_lcd('*')
BOOTSELLED1239USBRaspberryPiPico©2020RP2-8020/21P64M15.00TTT