import time
from machine import Pin
time.sleep(0.1)
timing = 0
pins = 7
pins_list = []
digit_list_hex = [
"0000001", # 0
"1001111", # 1
"0010010", # 2
"0000110", # 3
"1001100", # 4
"0100100", # 5
"0100000", # 6
"0001111", # 7
"0000000", # 8
"0000100", # 9
0x08, # A
0x03, # B
0x46, # C
0x21, # D
0x06, # E
0x0E, # F
0x7F # Empty
]
def setup():
global pins
global pins_list
for pin in range(pins):
assign = "pin" + str(pin)
assign = Pin(pin, Pin.OUT)
assign.value(1)
pins_list.append(assign)
print(pins_list)
def update():
global pins_list
global timing
if timing > 9:
timing = 0
splitted = digit_list_hex[timing]
counter = 0
for current_pin in pins_list:
state = int(splitted[counter])
current_pin.value(state)
counter = counter + 1
counter = 0
setup()
while True:
update()
time.sleep(1)
timing = timing + 1