from machine import Pin, SPI
import max7219
import time
######Display
#Intialize the SPI
spi = SPI(0, baudrate=10000000, polarity=1, phase=0, sck=Pin(2), mosi=Pin(3))
ss = Pin(5, Pin.OUT)
display = max7219.Matrix8x8(spi, ss, 4)
display.brightness(1)
scrolling_message = "WALK"
scrolling_message2 = "DON'T WALK"
length = len(scrolling_message)
length2 = len(scrolling_message2)
column = (length * 8)
display.fill(0)
display.show()
time.sleep(1)
######LEDS
LED_PIN1 = 6
LED_PIN2 = 12
led1 = machine.Pin(LED_PIN1, machine.Pin.OUT)
led2 = machine.Pin(LED_PIN2, machine.Pin.OUT)
while True:
for x in range(32, -column, -1):
led1.on()
display.fill(0)
display.text(scrolling_message ,x,0,1)
display.show()
time.sleep(0.05)
led1.off()
for x in range(32, -column, -1):
led2.on()
display.fill(0)
display.text(scrolling_message2 ,x,0,1)
display.show()
time.sleep(0.05)
led2.off()