Created
November 14, 2021 12:31
-
-
Save bodsch/ccd038316c2838fcc3b4d325c0214712 to your computer and use it in GitHub Desktop.
empty st7735 display
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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