NOTAS: CONFIGURACION BOTONES(VERTICAL HACIA ABAJO):
-1er PULSADOR: Decrementar el valor
-2do PULSADOR: Aumentar el valor
-3er PULSADOR: set point
-4to PULSADOR: reset
from machine import Pin
from time import sleep
#Configurar los pines de salida
A1= Pin(13,Pin.OUT)
A2= Pin(12,Pin.OUT)
Display=[14, 27, 26, 25, 21, 18, 15]
for i in range(len(Display)):
Pin(Display[i], Pin.OUT)
leds = [
[1,0,0,0,0,0,0],
[1,1,1,1,0,0,1],
[0,1,0,0,1,0,0],
[0,1,1,0,0,0,0],
[0,0,1,1,0,0,1],
[0,0,1,0,0,1,0],
[0,0,0,0,0,1,0],
[1,1,1,1,0,0,0],
[0,0,0,0,0,0,0],
[0,0,1,1,0,0,0],
]
C=0
s=0
a=0
Boton = Pin(23,Pin.IN)
Boton1 = Pin(22,Pin.IN)
Boton2 = Pin(32,Pin.IN)
Boton3 = Pin(33,Pin.IN)
anterior = 0
actual = 0
Boton.value(0)
contador=0
# Bucle principal
while True:
U=s%10
D=s//10
A1.value(0)
A2.value(1)
for j in range(7):
Pin(Display[j], Pin.OUT).value(leds[U][6-j])
sleep(0.2)
A1.value(1)
A2.value(0)
for j in range(7):
Pin(Display[j], Pin.OUT).value(leds[D][6-j])
sleep(0.2)
actual=Boton.value()
r=Boton1.value()
x=Boton2.value()
if actual == 1 and anterior == 0 :
s=s+1
sleep(0.5)
if r == 1 and anterior1 == 0 :
s=s-1
sleep(0.5)
print(s)
if x==1 :
a=s
print(a)
s=0
y=0
print(y)
while (y == 0) :
#print(s)
U1=s%10
D1=s//10
A1.value(0)
A2.value(1)
for j in range(7):
Pin(Display[j], Pin.OUT).value(leds[U1][6-j])
sleep(0.2)
A1.value(1)
A2.value(0)
for j in range(7):
Pin(Display[j], Pin.OUT).value(leds[D1][6-j])
sleep(0.2)
s=s+1
y=Boton3.value()
if s == a+1:
s=0
if y == 1 :
s=0
anterior = actual
anterior1= r