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)
display = Matrix8x8(spi, cs, 1)
display.brightness(10)
HEART_1 = [
0b00000000,
0b01100110,
0b11111111,
0b11111111,
0b11111111,
0b01111110,
0b00111100,
0b00011000
]
HEART_2 = [
0b00000000,
0b00100100,
0b01111110,
0b11111111,
0b01111110,
0b00111100,
0b00011000,
0b00000000
]
OVNI_1 = [
0b00011000,
0b00111100,
0b01111110,
0b11111111,
0b01111110,
0b00011000,
0b00100100,
0b00011000
]
OVNI_2 = [
0b00011000,
0b00111100,
0b01111110,
0b11111111,
0b01111110,
0b00011000,
0b00011000,
0b00100100
]
#dibujo
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:
for i in range(6):
show(HEART_1)
sleep(0.25)
show(HEART_2)
sleep(0.25)
for i in range(6):
show(OVNI_1)
sleep(0.25)
show(OVNI_2)
sleep(0.25)