from keypad import*
def display_message(line1, line2=""):
lcd_start()
string_write(line1)
cmd_wrt(0xC0) # Move to the second line
string_write(line2)
def main():
while True:
key = keyread()
if key != 0:
if key == 'A':
display_message("embedded")
elif key == 'B':
display_message("subject")
elif key == 'C':
cmd_wrt(0x01) # Clear the LCD
else:
# Display the pressed value at the center of line 2
cmd_wrt(0x01) # Clear the LCD
display_message("", zfl(key, 8))
sleep(0.2) # Adjust as needed
if __name__ == "__main__":
main()