from machine import Pin
from time import sleep
# Define the pins connected to the segments of the 7-segment display
pins = [
Pin(1, Pin.OUT), #A
Pin(2, Pin.OUT), #B
Pin(3, Pin.OUT), #C
Pin(4, Pin.OUT), #D
Pin(5, Pin.OUT), #E
Pin(6, Pin.OUT), #F
Pin(7, Pin.OUT), #G
]
# Define the digit you want to display (1 means the segment is on, 0 means off)
digits = [
#THIRD
[0, 0, 0, 1, 1, 1, 1], #t
[0, 0, 1, 0, 1, 1, 1], #h
[0, 1, 1, 0, 0, 0, 0], #I
[0, 0, 0, 0, 1, 0, 1], #r
[0, 1, 1, 1, 1, 0, 1], #d
#YEAR
[0, 1, 1, 1, 0, 1, 1], #y
[1, 0, 0, 1, 1, 1, 1], #E
[1, 1, 1, 0, 1, 1, 1], #A
[0, 0, 0, 0, 1, 0, 1], #r
#STUDENTS
[1, 0, 1, 1, 0, 1, 1], #S
[0, 0, 0, 1, 1, 1, 1], #t
[0, 1, 1, 1, 1, 1, 0], #u
[0, 1, 1, 1, 1, 0, 1], #d
[1, 0, 0, 1, 1, 1, 1], #E
[0, 0, 1, 0, 1, 0, 1], #n
[0, 0, 0, 1, 1, 1, 1], #t
[1, 0, 1, 1, 0, 1, 1], #S
]
def display_digit(digit):
for i in range(len(pins)):
pins[i].value(digit[i])
while True:
# Display "THIRD"
for digit in digits[0:5]:
display_digit(digit)
sleep(1)
sleep(2)
# Display "YEAR"
for digit in digits[5:9]:
display_digit(digit)
sleep(1)
sleep(2)
# Display "STUDENTS"
for digit in digits[9:17]:
display_digit(digit)
sleep(1)
sleep(2)