Toggle Navigation
Hatchery
Eggs
Badge_led_test
__init__.py
Login
Register
__init__.py
Content
import easydraw, system, badge, ugfx, sys import random def action_exit(pushed): if (pushed): # to turn off all the leds at ones badge.led(6,0,0,0) # go back to the home screen system.home() def show_names(): easydraw.msg("Led test!") badge.init() # do the magick endlesly while True: # loop over the leds for led_id in [0,1,2,3,4,5]: # default, turn off all the leds r, g, b = [0,0,0] # select a random color rgb = random.randint(1, 3) # turn ON the selected color if rgb == 1: r = 1 elif rgb == 2: g = 1 elif rgb == 3: b = 1 # turn the led to the selected state badge.led(led_id,r,g,b) def main(): ugfx.input_init() ugfx.input_attach(ugfx.BTN_B, action_exit) ugfx.input_attach(ugfx.BTN_START, action_exit) show_names() sys.stdin.read(1) #Wait for any key action_exit(True) main()