"""
INSTRUCTIONS
1. Finish defining the pins you will need to use for the 7 segment display
2. Make a total of 4 definitions, counting up to 3 starting from 0 (we're only doing 4 for sake of time)
3. Make a loop that resets to 0 once you are finished counting
4. Multiplex the signals by adding another 7 segment display off the breadboard with the same coffnection
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 control it digitally.
Bonus 1: Try to implement this off a physical circuit!
Bonus 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.
FUNCTIONS YOU WILL NEED
pin.off()
pin.on()
sleep()
Note if your code is wrong, this website won't tell you whats wrong and you might not get an output.
"""
from machine import Pin
from time import sleep
pin0 = Pin(GP0, Pin.OUT) #A
pin1 = Pin(GP1, Pin.OUT) #B
pin2 = Pin(GP2, Pin.OUT) #C
pin3 = Pin(GP3, Pin.OUT) #D
pin4 = Pin(GP4, Pin.OUT) #E
pin5 = Pin(GP5, Pin.OUT) #F
pin6 = Pin(GP6, Pin.OUT) #G
# for your reference, pin0 = A, pin1 = B, yadadada
def zero():
pin0.off()
pin1.off()
pin2.off()
pin3.off()
pin4.off()
pin5.off()
def one():
pin1.off()
pin2.off()
def two():
pin0.off()
pin1.off()
pin6.off()
pin3.off()
pin4.off()
def three():
pin0.off()
pin1.off()
pin2.off()
pin3.off()
pin6.off()
def off():
pin0.on()
pin1.on()
pin2.on()
pin3.on()
pin4.on()
pin5.on()
pin5.on()
while True:
off()
sleep(2)
zero()
sleep(2)
one()
sleep(2)
two()
sleep(2)
three()
sleep(2)
off()