from machine import  Pin
from utime import sleep
import random
LED1=Pin(0,Pin.OUT)
LED2=Pin(1,Pin.OUT)
LED3=Pin(2,Pin.OUT)
LED4=Pin(3,Pin.OUT)
LED5=Pin(4,Pin.OUT)
LED6=Pin(5,Pin.OUT)
LED7=Pin(6,Pin.OUT)
button=Pin(28,Pin.IN,Pin.PULL_DOWN)


Dice=[0X00,0X08,0X22,0X2A,0X55,0X5D,0X77]
def db(hexanumber):
  binaryString='{0:07b}'.format(hexanumber)
  LED1.value(int(binaryString[0]))
  LED2.value(int(binaryString[1]))
  LED3.value(int(binaryString[2]))
  LED4.value(int(binaryString[3]))
  LED5.value(int(binaryString[4]))
  LED6.value(int(binaryString[5]))
  LED7.value(int(binaryString[6]))


while True:
  if button.value():
    number=random.randint(1,6)
    num1=Dice[number]
    db(num1)
    print(number,'is blinking')
    sleep(0.5)
  

    


    











#https://wokwi.com/projects/347198395813724754
BOOTSELLED1239USBRaspberryPiPico©2020RP2-8020/21P64M15.00TTT