from machine import SPI, Pin
import time
spi = SPI(0, 500000, sck = Pin(6), mosi = Pin(7),miso = Pin(4) )
cs = Pin(5, Pin.OUT)
cs.value(1)
def Send(RegNum, data):
buff = [RegNum, data]
cs.value(0)
spi.write(bytearray(buff))
cs.value(1)
def Configure():
Send(0x09, 0)
Send(0x0A, 8)
Send(0x0B, 7)
Send(0x0C, 1)
def Paint(Data_out):
for i in range(0, 8):
Send(i + 1, Data_out[i])
Cuadro1 = [0xFF, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0xFF]
Cuadro2 = [0x00, 0x00, 0x3C, 0x24, 0x24, 0x3C, 0x00, 0x00]
Configure()
while True:
Paint(Cuadro1)
time.sleep_ms(300)
Paint(Cuadro2)
time.sleep_ms(300)