Closed
Description
"""
featherM4 & mini TFT joypad featherwing tester
"""
import board
import neopixel
import terminalio
import time
from adafruit_featherwing import minitft_featherwing
from adafruit_display_text import label
import gc
pixel = neopixel.NeoPixel(board.NEOPIXEL, 1)
pixel[0] = (0, 0, 0)
gc.collect()
print(gc.mem_free())
wing = minitft_featherwing.MiniTFTFeatherWing()
def getbuttons():
print(wing.buttons) # added just to see what is going on
buttons = wing.buttons
if buttons.right:
RIGHTtext = "RIGHT "
else:
RIGHTtext = ""
if buttons.down:
DOWNtext = "DOWN "
else:
DOWNtext = ""
if buttons.left:
LEFTtext = "LEFT "
else:
LEFTtext = ""
if buttons.up:
UPtext = "UP "
else:
UPtext = ""
if buttons.a:
Atext = "A "
else:
Atext = ""
if buttons.b:
Btext = "B "
else:
Btext = ""
if buttons.select:
SELtext = "SEL "
else:
SELtext = " "
texts = RIGHTtext + DOWNtext + LEFTtext + UPtext + Atext + Btext + SELtext
return texts
time.sleep(0.5)
while True:
text_area = label.Label(terminalio.FONT, text=getbuttons())
text_area.x = 45
text_area.y = 38
wing.display.show(text_area)
code tested with
Metadata
Metadata
Assignees
Labels
No labels