I am new in this forum and new in micropython. First, no code tags or BBCode is working in my post? Or i am to stuppid
I want to send a byte over spi.write, stored in an bytearray. Here are my testcode:
Code: Select all
from machine import Pin, SPI
import time
spi = SPI(-1, baudrate=100000, polarity=1, phase=0, sck=Pin(5), mosi=Pin(16), miso=Pin(4))
latch = Pin(12, Pin.OUT)
latch.on()
a = bytearray(2)
a[0] = 0b00000000
a[1] = 0b00001111
latch.off()
spi.write(a)
latch.on()
spi.write(a[0])
This doest work. This are the message from REPL: TypeError: object with buffer protocol required
Any idea?
Thanks