Toggle Navigation
Hatchery
Eggs
Backlight test
__init__.py
Login
Register
__init__.py
Content
import easydraw, system, ugfx, sys, samd, gc def action_exit(pushed): if(pushed): # go back to the home screen system.home() def global_vars(): global bl,bl_step,bl_max,bl_min bl = 50 bl_step = 10 bl_max = 200 bl_min = 10 def show_names(): easydraw.msg("Backlight test!") easydraw.msg("Use up, down") samd.backlight(bl) def action_up(push): global bl,bl_step,bl_max,bl_min if (push): gc.collect() if bl + bl_step <= bl_max: bl += bl_step easydraw.msg("Backlight up:") else: easydraw.msg("Backlight full:") set_bl() def action_down(push): global bl,bl_step,bl_max,bl_min if (push): gc.collect() if bl - bl_step >= bl_min: bl -= bl_step easydraw.msg("Backlight down:") else: easydraw.msg("Backlight at min:") set_bl() def set_bl(): samd.backlight(bl) easydraw.msg("bl {}".format(bl)) def main(): gc.collect() global_vars() ugfx.input_init() ugfx.input_attach(ugfx.BTN_B, action_exit) ugfx.input_attach(ugfx.BTN_START, action_exit) ugfx.input_attach(ugfx.JOY_UP,action_up) ugfx.input_attach(ugfx.JOY_DOWN,action_down) show_names() while True: sys.stdin.read(1) #Wait for any key action_exit(True) main()