from machine import Pin
from time import sleep
sw=Pin(2,Pin.IN, Pin.PULL_UP)
        #abcdefgh
seg7=[Pin(21, Pin.OUT),Pin(20, Pin.OUT),Pin(19, Pin.OUT),
      Pin(18, Pin.OUT),Pin(17, Pin.OUT),Pin(16, Pin.OUT),
      Pin(22, Pin.OUT),Pin(26, Pin.OUT)]
                #0                   #1                  #2                #3
seg7pattern=[[1,1,1,1,1,1,1,1],[0,0,0,0,0,0,1,1],[1,0,0,1,1,1,1,1],[0,0,1,0,0,1,0,1],[0,0,0,0,1,1,0,1],
                #4                   #5
             [1,0,0,1,1,0,0,1],[0,1,0,0,1,0,0,1],[0,1,0,0,0,0,0,1],[0,0,0,1,1,1,1,1],
                #8                   #9
             [0,0,0,0,0,0,0,1],[0,0,0,0,1,0,0,1]]

pat2=[[1,1,1,1,1,1,1,1],[0,0,0,0,1,0,0,1],[0,0,0,0,0,0,0,1],[0,0,0,1,1,1,1,1],
      [0,1,0,0,0,0,0,1],[0,1,0,0,1,0,0,1],[1,0,0,1,1,0,0,1],
      [0,0,0,0,1,1,0,1],[0,0,1,0,0,1,0,1],[1,0,0,1,1,1,1,1],
      [0,0,0,0,0,0,1,1]]

def display(number): #define function display
   for a in range(8):
      seg7[a].value(not(seg7pattern[number][a]))

def display1(number): #define function display
   for a in range(8):
      seg7[a].value(not(pat2[number][a]))

while 1:

   display(0)
   if(sw.value()==0):
      for i in range (11):
         display(i)
         sleep(0.5)
   else:
      for i in range (11):
         display1(i)
         sleep(0.5)
BOOTSELLED1239USBRaspberryPiPico©2020RP2-8020/21P64M15.00TTT
pico:GP0
pico:GP1
pico:GND.1
pico:GP2
pico:GP3
pico:GP4
pico:GP5
pico:GND.2
pico:GP6
pico:GP7
pico:GP8
pico:GP9
pico:GND.3
pico:GP10
pico:GP11
pico:GP12
pico:GP13
pico:GND.4
pico:GP14
pico:GP15
pico:GP16
pico:GP17
pico:GND.5
pico:GP18
pico:GP19
pico:GP20
pico:GP21
pico:GND.6
pico:GP22
pico:RUN
pico:GP26
pico:GP27
pico:GND.7
pico:GP28
pico:ADC_VREF
pico:3V3
pico:3V3_EN
pico:GND.8
pico:VSYS
pico:VBUS
sevseg1:COM.1
sevseg1:COM.2
sevseg1:A
sevseg1:B
sevseg1:C
sevseg1:D
sevseg1:E
sevseg1:F
sevseg1:G
sevseg1:DP
btn1:1.l
btn1:2.l
btn1:1.r
btn1:2.r