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)