from machine import Pin import time _init() segments = [14, 13, 4, 5, 12, 16, 15] # ABCDEFG for s in segments: led = Pin(s, Pin.OUT).off() digits = [ [1, 1, 1, 1, 1, 1, 0], # 0 [0, 1, 1, 0, 0, 0, 0], # 1 [1, 1, 0, 1, 1, 0, 1], # 2 [1, 1, 1, 1, 0, 0, 1], # 3 [0, 1, 1, 0, 0, 1, 1], # 4 [1, 0, 1, 1, 0, 1, 1], # 5 [1, 0, 1, 1, 1, 1, 1], # 6 [1, 1, 1, 0, 0, 0, 0], # 7 [1, 1, 1, 1, 1, 1, 1], # 8 [1, 1, 1, 1, 0, 1, 1], # 9 ] def draw_time(digit): for el in enumerate(digit): if (el[1]): Pin(segments[el[0]]).on() else: Pin(segments[el[0]]).off() while True: for digit in digits: draw_time(digit) time.sleep(1)