import time
time.sleep(0.1) # Wait for USB to become ready
print("Hello, Pi Pico!")
from machine import Pin,ADC
pot=ADC(Pin(26))
seg7a=(Pin(0,Pin.OUT),Pin(1,Pin.OUT),
Pin(2,Pin.OUT),Pin(3,Pin.OUT),
Pin(4,Pin.OUT),Pin(5,Pin.OUT),
Pin(6,Pin.OUT))
seg7b=(Pin(7,Pin.OUT),Pin(8,Pin.OUT),
Pin(9,Pin.OUT),Pin(10,Pin.OUT),
Pin(11,Pin.OUT),Pin(12,Pin.OUT),
Pin(13,Pin.OUT))
pattern=((1,1,1,1,1,1,0),(0,1,1,0,0,0,0),
(1,1,0,1,1,0,1),(1,1,1,1,0,0,1),
(0,1,1,0,0,1,1),(1,0,1,1,0,1,1),
(1,0,1,1,1,1,1),(1,1,1,0,0,0,0),
(1,1,1,1,1,1,1),(1,1,1,1,0,1,1))
def display7(value):
a=value%10
b=int(value/10)
for j in range(7):
seg7a[j].value(not(pattern[a][j]))
for j in range(7):
seg7b[j].value((pattern[b][j]))
while 1:
val=int(pot.read_u16()*99/65535)
display7(val)
time.sleep(0.5)