Close

Pretty Pictures

A project log for Trinket Shields

Add-on boards for the Adafruit Trinket M0.

dehipudeʃhipu 10/01/2017 at 22:162 Comments

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)

Discussions

davedarko wrote 10/01/2017 at 22:23 point

nice :) what's the resolution again?

  Are you sure? yes | no

deʃhipu wrote 10/01/2017 at 22:38 point

160x80, or rather 80x160

  Are you sure? yes | no