from machine import Pin
from time import sleep
def LCD(X):
D7.value(int(X[0]))
D6.value(int(X[1]))
D5.value(int(X[2]))
D4.value(int(X[3]))
D3.value(int(X[4]))
D2.value(int(X[5]))
D1.value(int(X[6]))
D0.value(int(X[7]))
RS.value(int(X[8]))
En.on()
sleep(0.1)
En.off()
RS=Pin(14,Pin.OUT)
En=Pin(23,Pin.OUT)
D7=Pin(15,Pin.OUT)
D6=Pin(2,Pin.OUT)
D5=Pin(4,Pin.OUT)
D4=Pin(5,Pin.OUT)
D3=Pin(18,Pin.OUT)
D2=Pin(19,Pin.OUT)
D1=Pin(21,Pin.OUT)
D0=Pin(22,Pin.OUT)
Pb1=Pin(12,Pin.IN,Pin.PULL_UP)
Pb2=Pin(13,Pin.IN,Pin.PULL_UP)
INI=["001100000","001100000","001100000","001110000","000101000","000011000","000001100","000000010"]
FEC=["001101011","101100001","010001101","010001011","010000101","010100101","010001011","010100101","010011111","101100001","001100101","001101101" , "000000100"]
FSU=["000000100" , "010100001","010100101","010000011","010000111","010101001","010010011","010000111","010000011","001000111","001100011" , "000000010"]
FIN=["000000010","110000000", "110000001","001100101","001101101","101100001","010011111","010000111","010101001","010101011","010000101","010100101","010001011","101100001","001100101","001101011", "000000100","000000010"]
RES=["000000010"]
for i in INI:
LCD(i)
while(1):
if Pb1.value()==1 and Pb2.value()==1:
for i in FEC:
LCD(i)
elif Pb1.value()==0 and Pb2.value()==1:
for i in FSU:
LCD(i)
elif Pb1.value()==1 and Pb2.value()==0:
for i in FIN:
LCD(i)
else:
for i in RES:
LCD(i)