import machine
import time
a = machine.Pin(19, machine.Pin.OUT)
b = machine.Pin(18, machine.Pin.OUT)
c = machine.Pin(5, machine.Pin.OUT)
d = machine.Pin(17, machine.Pin.OUT)
e = machine.Pin(16, machine.Pin.OUT)
f = machine.Pin(4, machine.Pin.OUT)
g = machine.Pin(8, machine.Pin.OUT)
h = machine.Pin(7, machine.Pin.OUT)
led_list = [a, b, c, d, e, f, g, h]
number_dict = {
0: "00000011",
1: "10011111",
2: "00100101",
3: "00001101",
4: "10011001",
5: "01001001",
6: "01000001",
7: "00011111",
8: "00000001",
9: "00001001"
}
def show_number(number):
if number_dict.get(number):
i=0
for num in number_dict.get(number):
if num == "1":
led_list[i].value(1)
else:
led_list[i].value(0)
i += 1
for i in range(10):
show_number(i)
time.sleep(1)Loading
esp32-devkit-c-v4
esp32-devkit-c-v4