def run(period=50): oled.oleds_clear(0) new_eyes() display_eyes() event.add_timer_handler(timer_handler, period) try: event.loop() finally: event.remove_timer_handler(timer_handler)
def run(period=50): oled.title = "Snake 0.0" oled.oleds_clear(0) snake_new() display_snake() event.add_timer_handler(timer_handler, period) try: event.loop() finally: event.remove_timer_handler(timer_handler)
def run(handler=snoot_boop_handler, period=100): event.add_timer_handler(handler, period) try: event.loop() finally: event.remove_timer_handler(handler)
file = open("repl") file.close() raise Exception("Exit to repl") except OSError: pass import gc def gc_event(): gc.collect() print(" ###### GC:", gc.mem_free(), gc.mem_alloc()) if parameter("gc_enabled"): # GC: 86368 9632 event.add_timer_handler(gc_event, 60000) import aiko.led as led # GC: 79696 16304 led.initialise() if parameter("oled_enabled"): # GC: 73088 22912 import aiko.oled as oled oled.initialise() import aiko.net as net # GC: 54304 41696 net.initialise() if parameter("application"): application_name = parameter("application") application = __import__(application_name) application.initialise() event.loop()
def run(handler=hall_sensor_handler, period=100): event.add_timer_handler(handler, period) try: event.loop() finally: event.remove_timer_handler(handler)