-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathmain.py
More file actions
24 lines (18 loc) · 663 Bytes
/
Copy pathmain.py
File metadata and controls
24 lines (18 loc) · 663 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# MicroPython ST7735 TFT display driver example usage
from machine import Pin, SPI
from tft import TFT_GREEN
# DC - RS/DC data/command flag
# CS - Chip Select, enable communication
# RST/RES - Reset
dc = Pin('GP3', Pin.OUT, Pin.PULL_DOWN)
cs = Pin('GP7', Pin.OUT, Pin.PULL_DOWN)
rst = Pin('GP4', Pin.OUT, Pin.PULL_DOWN)
# SPI Bus (CLK/MOSI/MISO)
# check your port docs to see which Pins you can use
spi = SPI(0, mode=SPI.MASTER, baudrate=8000000, polarity=1, phase=0)
# TFT object, this is ST7735R green tab version
tft = TFT_GREEN(128, 160, spi, dc, cs, rst)
# init TFT
tft.init()
# start using the driver
tft.clear(tft.rgbcolor(255, 0, 0))