Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
52 changes: 52 additions & 0 deletions examples/st7735r_18tftshield_buttons.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
"""
This example will test out the display on the 1.8" TFT Shield
"""
import time
import board
import displayio
from adafruit_seesaw.tftshield18 import TFTShield18
from adafruit_st7735r import ST7735R

reset_pin = 3
ss = TFTShield18()

spi = board.SPI()
tft_cs = board.D10
tft_dc = board.D8

displayio.release_displays()
display_bus = displayio.FourWire(spi, command=tft_dc, chip_select=tft_cs)

ss.tft_reset()
display = ST7735R(display_bus, width=160, height=128, rotation=90, bgr=True)

ss.set_backlight(True)

while True:
buttons = ss.buttons

if buttons.right:
print("Button RIGHT!")

if buttons.down:
print("Button DOWN!")

if buttons.left:
print("Button LEFT!")

if buttons.up:
print("Button UP!")

if buttons.select:
print("Button SELECT!")

if buttons.a:
print("Button A!")

if buttons.b:
print("Button B!")

if buttons.c:
print("Button C!")

time.sleep(.001)