Skip to content

Commit 393fa95

Browse files
authored
Merge pull request #8 from makermelissa/master
Example for 1.8 inch TFT Shield
2 parents aeed58e + b1293e3 commit 393fa95

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1+
*.mpy
2+
.idea
13
__pycache__
24
_build
35
*.pyc
46
.env
57
build*
68
bundles
9+
*.DS_Store
10+
.eggs
11+
dist
12+
**/*.egg-info
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
"""
2+
This example will test out the display on the 1.8" TFT Shield
3+
"""
4+
import time
5+
import board
6+
import displayio
7+
from adafruit_seesaw.tftshield18 import TFTShield18
8+
from adafruit_st7735r import ST7735R
9+
10+
reset_pin = 3
11+
ss = TFTShield18()
12+
13+
spi = board.SPI()
14+
tft_cs = board.D10
15+
tft_dc = board.D8
16+
17+
displayio.release_displays()
18+
display_bus = displayio.FourWire(spi, command=tft_dc, chip_select=tft_cs)
19+
20+
ss.tft_reset()
21+
display = ST7735R(display_bus, width=160, height=128, rotation=90, bgr=True)
22+
23+
ss.set_backlight(True)
24+
25+
while True:
26+
buttons = ss.buttons
27+
28+
if buttons.right:
29+
print("Button RIGHT!")
30+
31+
if buttons.down:
32+
print("Button DOWN!")
33+
34+
if buttons.left:
35+
print("Button LEFT!")
36+
37+
if buttons.up:
38+
print("Button UP!")
39+
40+
if buttons.select:
41+
print("Button SELECT!")
42+
43+
if buttons.a:
44+
print("Button A!")
45+
46+
if buttons.b:
47+
print("Button B!")
48+
49+
if buttons.c:
50+
print("Button C!")
51+
52+
time.sleep(.001)

0 commit comments

Comments
 (0)