from machine import Pin
import time

a = Pin(19, Pin.OUT)
b = Pin(18, Pin.OUT)
c = Pin(15, Pin.OUT)
d = Pin(14, Pin.OUT)
e = Pin(13, Pin.OUT)
f = Pin(20, Pin.OUT)
g = Pin(21, Pin.OUT)

# Botón negro
boton1 = Pin(0, Pin.IN, Pin.PULL_DOWN)

# Botón rojo
boton2 = Pin(2, Pin.IN, Pin.PULL_DOWN)

display = [a, b, c, d, e, f, g]

digitos = {
    0: [0, 0, 0, 0, 0, 0, 1],
    1: [1, 0, 0, 1, 1, 1, 1],
    2: [0, 0, 1, 0, 0, 1, 0],
    3: [0, 0, 0, 0, 1, 1, 0],
    4: [1, 0, 0, 1, 1, 0, 0],
    5: [0, 1, 0, 0, 1, 0, 0],
    6: [0, 1, 0, 0, 0, 0, 0],
    7: [0, 0, 0, 1, 1, 1, 1],
    8: [0, 0, 0, 0, 0, 0, 0],
    9: [0, 0, 0, 0, 1, 0, 0]
}

conta = 0

def mostrar(num):
    for i in range(7):
        display[i].value(digitos[num][i])

while True:
    mostrar(conta)
    if boton1.value() == 1:
        conta += 1
        if conta > 9:
            conta = 0
    if boton2.value() == 1:
        conta -= 1
        if conta < 0:
            conta = 9
    time.sleep_ms(250)
$abcdeabcde151015202530354045505560fghijfghij
BOOTSELLED1239USBRaspberryPiPico©2020RP2-8020/21P64M15.00TTT