from machine import Pin
from time import sleep 

def display(x,t):
    A1.value(int(x[0]))
    B1.value(int(x[1]))
    C1.value(int(x[2]))
    D1.value(int(x[3]))
    E1.value(int(x[4]))
    F1.value(int(x[5]))
    G1.value(int(x[6]))
    sleep(t)
   

A1 = Pin(23,Pin.OUT)
B1 = Pin(22,Pin.OUT)
C1 = Pin(21,Pin.OUT)
D1 = Pin(19,Pin.OUT)
E1 = Pin(18,Pin.OUT)
F1 = Pin(17,Pin.OUT)
G1 = Pin(16,Pin.OUT)
Bot = Pin(14,Pin.IN, Pin.PULL_DOWN)
ret=0.5
t=1

lista=["1111110","0110000","1101101","1111001","0110011","1011011","1011111","1110000","1111111","1110011","1110111","0011111","1001110","0111101","1001111","1000111"]

while(1): 
    if bot.value() == 1:  
        for i in range(15, -1, -1):
            display(lista[i], ret)
    else:  
        for i in range(16):
            display(lista[i], ret)