SunFounder ESP32 Starter Kit
(continued from previous page)
if key == "Power":
init_new_value()
lcd_show(False)
elif key == "+":
result = number_processing()
lcd_show(result)
if result:
time.sleep(5)
init_new_value()
lcd_show(False)
else:
lcd_show(False)
elif key.isdigit():
count = count * 10 + int(key) if count * 10 + int(key) <= 99 else count
lcd_show(False)
# Decode the received data and return the corresponding key name
def decodeKeyValue(data):
if data == 0x16:
return "0"
if data == 0x0C:
return "1"
if data == 0x18:
return "2"
if data == 0x5E:
return "3"
if data == 0x08:
return "4"
if data == 0x1C:
return "5"
if data == 0x5A:
return "6"
if data == 0x42:
return "7"
if data == 0x52:
return "8"
if data == 0x4A:
return "9"
if data == 0x09:
return "+"
if data == 0x15:
return "-"
if data == 0x7:
return "EQ"
if data == 0x0D:
return "U/SD"
if data == 0x19:
return "CYCLE"
if data == 0x44:
return "PLAY/PAUSE"
if data == 0x43:
return "FORWARD"
(continues on next page)
436 Chapter 3. For MicroPython User