from machine import Pin, SPI
from time import sleep
from max7219 import Matrix8x8
spi = SPI(0, baudrate=10000000, polarity=0, phase=0,
sck=Pin(18), mosi=Pin(19))
cs = Pin(17, Pin.OUT)
TRIANGULO = [
0b00011000,
0b00111100,
0b01111110,
0b11111111,
0b11111111,
0b01111110,
0b00111100,
0b00011000
]
FLECHA = [
0b00011000,
0b00111100,
0b01111110,
0b11111111,
0b00011000,
0b00011000,
0b00011000,
0b00011000
]
INTERROGACION = [
0b00111100,
0b01100110,
0b00000110,
0b00001100,
0b00011000,
0b00011000,
0b00000000,
0b00011000
]
CIRCULO = [
0b00111100,
0b01100110,
0b11000011,
0b11000011,
0b11000011,
0b11000011,
0b01100110,
0b00111100
]
CRUZ = [
0b00011000,
0b00011000,
0b00011000,
0b11111111,
0b11111111,
0b00011000,
0b00011000,
0b00011000
]
def show(m):
display.fill(0)
for y in range(8):
fila = m[y]
for x in range(8):
if (fila >> (7-x)) & 1:
display.pixel(x, y, 1)
display.show()
while True:
show(TRIANGULO)
sleep(1)
show(FLECHA)
sleep(1)
show(INTERROGACION)
sleep(1)
show(CIRCULO)
sleep(1)
show(CRUZ)
sleep(1)