from machine import Pin
import time
a=Pin(23, Pin.OUT)
b=Pin(22, Pin.OUT)
c=Pin(21, Pin.OUT)
d=Pin(19, Pin.OUT)
e=Pin(18, Pin.OUT)
f=Pin(5, Pin.OUT)
g=Pin(17, Pin.OUT)
dp=Pin(16, Pin.OUT)
first_seven=Pin(4, Pin.OUT)
second_seven=Pin(2, Pin.OUT)
third_seven=Pin(15, Pin.OUT)
fouth_seven=Pin(13, Pin.OUT)
a.value(1)
b.value(1)
c.value(1)
d.value(1)
e.value(1)
f.value(1)
g.value(1)
dp.value(1)
def clear_1():
a.value(1) #for clear
b.value(1)
c.value(1)
d.value(1)
e.value(1)
f.value(1)
g.value(1)
dp.value(1)
def two(dot=False):
a.value(0) #for 2
b.value(0)
d.value(0)
e.value(0)
g.value(0)
dp.value(0 if dot else 1)
time.sleep(0.005)
def one():
b.value(0)
c.value(0)
time.sleep(0.005)
def three():
a.value(0) #for 3
b.value(0)
c.value(0)
d.value(0)
g.value(0)
time.sleep(0.005)
def four():
b.value(0)
c.value(0)
f.value(0)
g.value(0)
time.sleep(0.005)
def five():
a.value(0)
c.value(0)
d.value(0)
f.value(0)
g.value(0)
time.sleep(0.005)
def six():
a.value(0)
c.value(0)
d.value(0)
e.value(0)
f.value(0)
g.value(0)
time.sleep(0.005)
def seven():
a.value(0)
b.value(0)
c.value(0)
time.sleep(0.005)
def eight():
a.value(0)
b.value(0)
c.value(0)
d.value(0)
e.value(0)
f.value(0)
g.value(0)
time.sleep(0.005)
def nine():
a.value(0)
b.value(0)
c.value(0)
d.value(0)
f.value(0)
g.value(0)
time.sleep(0.005)
def zero():
a.value(0)
b.value(0)
c.value(0)
d.value(0)
e.value(0)
f.value(0)
time.sleep(0.005)
while True:
first_seven.value(1)
one()
clear_1()
first_seven.value(0)
second_seven.value(1)
two(dot=True)
clear_1()
second_seven.value(0)
third_seven.value(1)
five()
clear_1()
third_seven.value(0)
fouth_seven.value(1)
two()
clear_1()
fouth_seven.value(0)