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])),RS.value(int(x[4]))
E.on()
sleep(.01)
E.off()
E0=Pin(13,Pin.IN,Pin.PULL_DOWN)
E1=Pin(12,Pin.IN,Pin.PULL_DOWN)
E2=Pin(14,Pin.IN,Pin.PULL_DOWN)
D7=Pin(15,Pin.OUT)
D6=Pin(18,Pin.OUT)
D5=Pin(19,Pin.OUT)
D4=Pin(21,Pin.OUT)
E=Pin(22,Pin.OUT)
RS=Pin(23,Pin.OUT)
Inicio=["00000","00100","00100","10000","00000","00010","00000","11000","00000","11000"]
Victor=["00000","00100","01011","01101","01101","10011","01101","00111","01111","01001","01101","11111","01111","00101","11111","11101","01001","11011","01001","11011","01011","00101","00000","00100"]
Fecha=["11000","00000","00111","00011","00111","01001","00101","11111","01001","11111","01101","00111","01111","01001","00101","11111","00111","00101","00111","00001","00111","00101","00111","00101","00000","00100"]
Borrar_L1=["00000","00100","11111","11101","11111","11101","11111","11101","11111","11101","11111","11101","11111","11101","11111","11101","11111","11101","11111","11101","11111","11101","00000","00100"]
Reset=["00000","00010"]
for i in Inicio:
LCD(i)
while(1):
v1=E0.value()
v2=E1.value()
v3=E2.value()
VT=4*v1+2*v2+v3
if(VT==4):
for i in Fecha:
LCD(i)
sleep(.05)
elif(VT==2):
for i in Borrar_L1:
LCD(i)
sleep(.05)
elif(VT==1):
for i in Reset:
LCD(i)
sleep(.02)
else:
for i in Victor:
LCD(i)
sleep(.08)