def buttonPressed(button): global linePos, colPos, menu if button == LCD.UP: if linePos > 0: linePos -= 1 scrollLines() else: showDone() elif button == LCD.DOWN: if linePos < len(menu[colPos]) - 1: linePos += 1 scrollLines() else: showDone() elif button == LCD.LEFT: if colPos > 0: colPos -= 1 linePos = 0 scrollLines() else: showDone() elif button == LCD.RIGHT: menu = lcdHelper.buildMenu() if colPos < len(menu) - 1: colPos += 1 linePos = 0 scrollLines() else: showDone() elif button == LCD.SELECT: executeAction(menu[colPos][linePos][2])
return False lcd.set_cursor(0, 1) lcd.message(">> TIME UP ") lastButtonTime = nowTime showError(1) return False ############### START HERE ############### # the LCD object lcd = LCD.Adafruit_CharLCDPlate() # these are our position in the menu array menu = lcdHelper.buildMenu() linePos = 0 colPos = 0 screenOn = False # the last button pnd time it was pressed - for debouncing lastButton = -1 lastButtonTime = time.time() # last time the bottom line was refreshed lastUpdateTime = time.time() # listen for SIGINT signal.signal(signal.SIGINT, signal_handler) go = True # this will be set to alse if we receive a sig