from machine import Pin, Timer
# Create tuple of the seven segment cathodes.
segs = (Pin('GP0',Pin.OUT), Pin('GP2',Pin.OUT), Pin('GP13',Pin.OUT), Pin('GP14',Pin.OUT),
Pin('GP15',Pin.OUT), Pin('GP1',Pin.OUT), Pin('GP12',Pin.OUT))
digits = [(0,0,0,0,0,0,1), (1,0,0,1,1,1,1), (0,0,1,0,0,1,0), (0,0,0,0,1,1,0),
(1,0,0,1,1,0,0), (0,1,0,0,1,0,0), (0,1,0,0,0,0,0), (0,0,0,1,1,1,1),
(0,0,0,0,0,0,0), (0,0,0,0,1,0,0)]
counter = 0
def digitCounter(timer):
global counter
for i in range(7):
segs[i].value(digits[counter][i])
if counter < 9:
counter = counter + 1
else:
counter = 0
tmr = Timer(period = 500, callback=digitCounter)Loading
pi-pico-w
pi-pico-w