from m5stack import *
from m5ui import *
from uiflow import *
import face
setScreenColor(0x222222)
faces_calc = face.get(face.CALC)
input2 = None
sum2 = None
result = None
lcd.fill(0x000000)
input2 = '0'
sum2 = []
result = 0
lcd.font(lcd.FONT_DejaVu40)
while True:
lcd.print(input2, 0, 0, 0xffffff)
lcd.print(result, 0, 200, 0xffffff)
print(sum2)
if (faces_calc.readKey()) > 42 and (faces_calc.readKey()) < 66:
input2 = faces_calc.readStr()
if input2[0] == 'A' or input2[-1] == 'A':
faces_calc.clearStr()
input2 = '0'
result = 0
sum2 = []
lcd.clear()
if input2[-1] == '+':
input2 = input2.replace('+', '')
sum2.insert(0, int(input2))
faces_calc.clearStr()
input2 = '0'
lcd.clear()
elif input2[-1] == '=' and result <= 0:
input2 = input2.replace('=', '')
sum2.insert(0, int(input2))
input2 = '0'
result = sum(sum2)
faces_calc.clearStr()
lcd.clear()
elif input2[0] == '+':
faces_calc.clearStr()
wait_ms(2)
Comments