Skip to content

Instantly share code, notes, and snippets.

@remisarrailh
Created January 12, 2021 15:16
Show Gist options
  • Save remisarrailh/55beeb646ca9a85f575d58a27657ea0a to your computer and use it in GitHub Desktop.
Save remisarrailh/55beeb646ca9a85f575d58a27657ea0a to your computer and use it in GitHub Desktop.
LILYGO® TTGO T8 ESP32-S2 LCD Test (circuitpython)
import digitalio
import board
import busio
import adafruit_rgb_display.st7789 as st7789
from adafruit_rgb_display import color565
import time
miso_pin = board.IO4
mosi_pin = board.IO35
clk_pin = board.IO36
reset_pin = board.IO38
cs_pin = board.IO34
dc_pin = board.IO37
backlight_pin = board.IO33
backlight = digitalio.DigitalInOut(backlight_pin)
backlight.direction = digitalio.Direction.OUTPUT
backlight.value = True
spi = busio.SPI(clock=clk_pin, MOSI=mosi_pin, MISO=miso_pin)
display = st7789.ST7789(spi,
width=135,
height=240,
y_offset=40,
x_offset=50,
rotation=90,
cs=digitalio.DigitalInOut(cs_pin),
dc=digitalio.DigitalInOut(dc_pin),
rst=digitalio.DigitalInOut(reset_pin))
while True:
# Clear the display
display.fill(0)
# Draw a red pixel in the center.
print("BLACK")
# Pause 2 seconds.
# Clear the screen blue.
display.fill(color565(255, 0, 255))
print("Blue")
# Pause 2 seconds.
@jared-onionfive
Copy link

jared-onionfive commented Sep 24, 2021

Hi, thanks for sharing this!!
I was wondering how you determined correct I0 pins, because I am having trouble finding documentation!

By any chance do you know what I0 pin is used for ready / ESP_BUSY?
esp32_ready = DigitalInOut(board.ESP_BUSY)

Kind Regards
Jared

@remisarrailh
Copy link
Author

I may be wrong but it seems ESP_BUSY / ESP_RESET is used only when you use a ESP32 as a wifi modem with another microcontroller.
For example: https://learn.adafruit.com/circuitpython-on-the-arduino-nano-rp2040-connect/wifi

For reference, here is the pinout of the Lilygo ESP32_S2.
image

@theboyknowsclass
Copy link

anyone know what pins the "KEY" button is connected to?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment