Toggle Navigation
Hatchery
Eggs
Button tester
__init__.py
Users
Badges
Login
Register
__init__.py
raw
Content
import display, buttons joyLeft = False joyPress = False joyDown = False joyRight = False joyUp = False btnAccept = False btnBack = False btnHome = False btnMenu = False btnSelect = False btnStart = False def draw(): global joyLeft, joyRight, joyPress, joyDown, joyUp, btnAccept, btnBack, btnHome, btnMenu, btnStart, btnSelect display.drawFill(0x000000) text = "" text += " - Home: " + ("Pressed" if btnHome else "Released") + "\n" text += " - Menu: " + ("Pressed" if btnMenu else "Released") + "\n" text += " - Start: " + ("Pressed" if btnStart else "Released") + "\n" text += " - Select: " + ("Pressed" if btnSelect else "Released") + "\n" text += " - Accept: " + ("Pressed" if btnAccept else "Released") + "\n" text += " - Back: " + ("Pressed" if btnBack else "Released") + "\n" text += " - Left: " + ("Pressed" if joyLeft else "Released") + "\n" text += " - Right: " + ("Pressed" if joyRight else "Released") + "\n" text += " - Up: " + ("Pressed" if joyUp else "Released") + "\n" text += " - Down: " + ("Pressed" if joyDown else "Released") + "\n" text += " - Pressed: " + ("Pressed" if joyPress else "Released") + "\n" display.drawText(0,0,text, 0xFFFFFF, "ocra16") print(text) display.flush() def left(p): global joyLeft joyLeft = p draw() def joy(p): global joyPress joyPress = p draw() def down(p): global joyDown joyDown = p draw() def up(p): global joyUp joyUp = p draw() def right(p): global joyRight joyRight = p draw() def start(p): global btnStart btnStart = p draw() def select(p): global btnSelect btnSelect = p draw() def home(p): global btnHome btnHome = p draw() def menu(p): global btnMenu btnMenu = p draw() def accept(p): global btnAccept btnAccept = p draw() def back(p): global btnBack btnBack = p draw() buttons.attach(buttons.BTN_UP, up) buttons.attach(buttons.BTN_DOWN, down) buttons.attach(buttons.BTN_LEFT, left) buttons.attach(buttons.BTN_RIGHT, right) buttons.attach(buttons.BTN_HOME, home) buttons.attach(buttons.BTN_MENU, menu) buttons.attach(buttons.BTN_START, start) buttons.attach(buttons.BTN_SELECT, select) buttons.attach(buttons.BTN_A, accept) buttons.attach(buttons.BTN_B, back) buttons.attach(buttons.BTN_PRESS, joy) draw()