Skip to content

Instantly share code, notes, and snippets.

@bodsch
Created November 14, 2021 12:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bodsch/ccd038316c2838fcc3b4d325c0214712 to your computer and use it in GitHub Desktop.
Save bodsch/ccd038316c2838fcc3b4d325c0214712 to your computer and use it in GitHub Desktop.
empty st7735 display
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont
import time
import ST7735
DC = 24
RST = 25
SPI_PORT = 0
SPI_DEVICE = 0
# Create ST7735 LCD display class.
disp = ST7735.ST7735(
port = SPI_PORT,
cs = SPI_DEVICE, # ST7735.BG_SPI_CS_FRONT, # BG_SPI_CSB_BACK or BG_SPI_CS_FRONT
dc = DC,
rst = RST,
backlight = 18, # 18 for back BG slot, 19 for front BG slot.
width = 128,
height = 160,
offset_top = 0,
offset_left = 0,
invert=False,
)
# Initialize display.
disp.begin()
color=(0,0,0)
buffer = Image.new('RGB', (disp.width, disp.height))
width, height = buffer.size
buffer.putdata([color]*(width*height))
disp.display(buffer)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment