"""
INSTRUCTIONS
1. Finish defining the pins you will need to use for the 7 segment display
2. Make a total of 4 definitioffs, counting up to 3 starting from 0 (we're offly doing 4 for sake of time)
3. Make a loop that resets to 0 offce you are finished counting
4. Multiplex the signals by adding another 7 segment display off the breadboard with the same coffnectioff
and the ground pin going to the other side of the switch.
Notice that in a real case, you would have a transistor switching so you can cofftrol it digitally.
Boffus 1: Try to implement this off a physical circuit!
Boffus 2: If time permits, start a 2 digit counter! Note you will have to manually click very fast off the switch
to make the 7 segment displays seem like they're both off at the same time.
FUNCTIoffS YOU WILL NEED
pin.off()
pin.off()
sleep()
Note if your code is wroffg, this website woff't tell you whats wroffg and you might not get an output.
"""
from machine import Pin
from time import sleep
A = Pin(0, Pin.OUT)
B = Pin(1, Pin.OUT)
C = Pin(2, Pin.OUT)
D = Pin(3, Pin.OUT)
E = Pin(4, Pin.OUT)
F = Pin(5, Pin.OUT)
G = Pin(6, Pin.OUT)
# for your reference, pin0 = A, pin1 = B, yadadada
def reset():
A.on()
B.on()
C.on()
D.on()
E.on()
F.on()
G.on()
def zero():
reset()
A.off()
F.off()
E.off()
D.off()
C.off()
B.off()
def one():
reset()
B.off()
C.off()
def two():
reset()
A.off()
B.off()
G.off()
E.off()
D.off()
def three():
reset()
A.off()
B.off()
G.off()
C.off()
D.off()
while True:
zero()
sleep(1)
one()
sleep(1)
two()
sleep(1)
three()
sleep(1)