Toggle Navigation
Hatchery
Eggs
NickNameSlider
__init__.py
Login
Register
__init__.py
Content
import system, badge, display, ugfx, random def actionExit(pushed): if (pushed): # go back to the home screen system.home() def randomLed(): badge.led(6,0,0,0) red = random.randint(0, 1) green = random.randint(0, 1) blue = random.randint(0, 1) ledIndex = random.randint(0, 5) badge.led(ledIndex, red, green, blue) def slideName(): badge.init() nick = badge.nvs_get_str('owner', 'name', 'ael') screenWidth = display.width() screenHeight = display.height() fontSize = 22 font = "permanentmarker" + str(fontSize) textWidth = display.getTextWidth(nick, font) yPositon = int((screenHeight - display.getTextHeight(nick, font)) / 2) speed = 2 for xPosition in range(screenWidth, -textWidth, -speed): display.drawFill(0xFFFFFF) display.drawText(xPosition, yPositon, nick, 0x000000, font) display.flush() def main(): ugfx.input_init() ugfx.input_attach(ugfx.BTN_B, actionExit) ugfx.input_attach(ugfx.BTN_START, actionExit) while(True): randomLed() slideName() main()