#Display 0 to 9 on C.A. 7-segment display
# pin16-a,pin17-b,pin18-c,pin19-d,pin21-e,pin22-f,pin23-g,
#pin15-dp
from machine import Pin
from time import sleep, sleep_ms
pins=[Pin(16,Pin.OUT),Pin(17,Pin.OUT),Pin(18,Pin.OUT),Pin(19,Pin.OUT),Pin(21,Pin.OUT),Pin(22,Pin.OUT),Pin(23,Pin.OUT),Pin(15,Pin.OUT)]
digits=[[0,0,0,0,0,0,1,0], # 0
[1,0,0,1,1,1,1,0], # 1
[0,0,1,0,0,1,0,0], # 2
[0,0,0,0,1,1,0,0], # 3
[1,0,0,1,1,0,0,0], # 4
[0,1,0,0,1,0,0,0], # 5
[0,1,0,0,0,0,0,0], # 6
[0,0,0,1,1,1,1,0], # 7
[0,0,0,0,0,0,0,0], # 8
[0,0,0,1,1,0,0,0] # 9
]
while True:
for i in range(10):
for j in range (8):
pins[j].value(digits[i][j])
sleep(2)