from machine import Pin
from time import sleep
#led = Pin(0,Pin.OUT)
#botao = Pin(1,Pin.IN,Pin.PULL_UP)
#Azul
display_unidade = [
Pin(1,Pin.OUT), #A1
Pin(2,Pin.OUT), #B1
Pin(3,Pin.OUT), #C1
Pin(4,Pin.OUT), #D1
Pin(5,Pin.OUT), #E1
Pin(6,Pin.OUT), #F1
Pin(7,Pin.OUT) #G1
]
#Roxo
display_dezena = [
Pin(8,Pin.OUT), #A2
Pin(9,Pin.OUT), #B2
Pin(10,Pin.OUT), #C2
Pin(11,Pin.OUT), #D2
Pin(12,Pin.OUT), #E2
Pin(13,Pin.OUT), #F2
Pin(14,Pin.OUT) #G2
]
#Ciano
display_centena = [
Pin(15,Pin.OUT), #A3
Pin(16,Pin.OUT), #B3
Pin(17,Pin.OUT), #C3
Pin(18,Pin.OUT), #D3
Pin(19,Pin.OUT), #E3
Pin(20,Pin.OUT), #F3
Pin(21,Pin.OUT) #G3
]
digitos = [
[0, 0, 0, 0, 0, 0, 1], # 0
[1, 0, 0, 1, 1, 1, 1], # 1
[0, 0, 1, 0, 0, 1, 0], # 2
[0, 0, 0, 0, 1, 1, 0], # 3
[1, 0, 0, 1, 1, 0, 0], # 4
[0, 1, 0, 0, 1, 0, 0], # 5
[0, 1, 0, 0, 0, 0, 0], # 6
[0, 0, 0, 1, 1, 1, 1], # 7
[0, 0, 0, 0, 0, 0, 0], # 8
[0, 0, 0, 0, 1, 0, 0] # 9
]
def reset ():
for Pin in display_unidade + display_dezena + display_centena:
Pin.value(1)
while True:
for numero in range(100):
centena = numero//100
dezena = (numero-centena*100)//10
unidade = numero%10
for led in range(7):
display_unidade[led].value(digitos[unidade][led])
for led in range(7):
display_dezena[led].value(digitos[dezena][led])
for led in range(7):
display_centena[led].value(digitos[centena][led])
sleep(0.25)