import keypad as key
import lcd4bit 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(0x80)
lcd.strwrite("correct password")
else:
lcd.cmdwrite(0x80)
lcd.strwrite("wrong password")
passin=""
elif a=='*':
lcd.cmdwrite(0x01)
lcd.strwrite("insert password")
passin="" #reset variable
else:
passin+=a
print(passin)
lcd.cmdwrite(0xc4)
lcd.strwrite(" ")
lcd.cmdwrite(0xc4)
for i in passin:
lcd.strwrite('*')
sleep(0.3)