Toggle Navigation
Hatchery
Eggs
Random lines
__init__.py
Login
Register
__init__.py
Content
import system, badge, ugfx, sys import random def action_exit(pushed): if (pushed): system.home() def action_b0(pushed): if (pushed): badge.led(0,1,0,0) else: badge.led(0,0,0,0) def action_b1(pushed): if (pushed): badge.led(1,1,0,0) else: badge.led(1,0,0,0) def action_b4(pushed): if (pushed): badge.led(4,1,0,0) else: badge.led(4,0,0,0) def action_b5(pushed): if (pushed): badge.led(5,1,0,0) else: badge.led(5,0,0,0) def clear(): ugfx.clear(ugfx.WHITE) def action_clear(pushed): if (pushed): clear() def main_worker(): clear() invert = False count = 0 # do the magick endlesly while True: x1 = random.randrange(128) y1 = random.randrange(64) x2 = random.randrange(128) y2 = random.randrange(64) ugfx.line(x1, y1, x2, y2, ugfx.WHITE if invert else ugfx.BLACK ) ugfx.string(1,26,"sharedinventions.com","Roboto_Regular12", ugfx.BLACK if invert else ugfx.WHITE) ugfx.flush() count += 1 if count >= 2000: invert = not invert count = 0 def main(): badge.init() ugfx.input_init() ugfx.input_attach(ugfx.BTN_B, action_exit) ugfx.input_attach(ugfx.JOY_UP, action_b0) ugfx.input_attach(ugfx.JOY_DOWN, action_b1) ugfx.input_attach(ugfx.JOY_LEFT, action_b4) ugfx.input_attach(ugfx.JOY_RIGHT, action_b5) ugfx.input_attach(ugfx.BTN_START, action_clear) main_worker() sys.stdin.read(1) #Wait for any key action_exit(True) main()