diff --git a/.gitignore b/.gitignore index 0dd8629..cc1a9c8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,12 @@ +*.mpy +.idea __pycache__ _build *.pyc .env build* bundles +*.DS_Store +.eggs +dist +**/*.egg-info diff --git a/examples/st7735r_18tftshield_buttons.py b/examples/st7735r_18tftshield_buttons.py new file mode 100644 index 0000000..0faf7cf --- /dev/null +++ b/examples/st7735r_18tftshield_buttons.py @@ -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)