Pretty Pictures¶
Published on 2017-10-02 in Trinket Shields.
I realized that all I have been showing on the TFT shield screen are some random pixels — that doesn’t really prove that it works correctly, does it? So I made a quick demo, displaying the CircuitPython’s mascot, Blinka:
And the code:
import board
import digitalio
import busio
from adafruit_rgb_display import st7735
dc = digitalio.DigitalInOut(board.D0)
cs = digitalio.DigitalInOut(board.D1)
spi = busio.SPI(clock=board.SCK, MOSI=board.MOSI)
d = st7735.ST7735R(spi, cs=cs, dc=dc)
d.fill(0)
with open("blinka.raw", "rb") as f:
for y in range(80):
buf = f.read(320)
d._block(y + 24, 0, y + 24, 159, buf)