/******************************
The pin connections are as follows:
MAX7219 VCC pin to Raspberry Pi Pico 5V pin
MAX7219 GND pin to Raspberry Pi Pico GND pin
MAX7219 DIN pin to Raspberry Pi Pico GPIO3 pin
MAX7219 CS pin to Raspberry Pi Pico GPIO5 pin
MAX7219 CLOCK pin to Raspberry Pi Pico GPIO2 pin
************************************/
# Import the max7219 module
from max7219 import Matrix8x8
# Create an instance of the matrix with the pin numbers
matrix = Matrix8x8(spi=0, cs=5, num=1)
# Set the brightness of the matrix (0-15)
matrix.brightness(15)
# Clear the matrix
matrix.fill(0)
# Define the text to scroll
text = "Hello World!"
# Loop through the text and scroll it on the matrix
for i in range(len(text) * 8):
# Shift the matrix to the left by one pixel
matrix.scroll(-1, 0)
# Draw the next character on the rightmost column
matrix.text(text[i // 8], 7 - (i % 8), 0, 1)
# Show the matrix
matrix.show()
# Wait for 50 milliseconds
matrix.sleep_ms(50)