示例#1
0
            ldr_value = mcp_values[7]
            effects.lightsensor(ldr_value)

        for i in range(len(PUSH_BUTTON_PINS)):
            push[i] = push_buttons.get_button(i)

        comm_changes, comm_msg = communication.get()

        if comm_changes:
            print "TODO: Do something with %r" % comm_msg

        # Switch hi-res-mode
        if push[0] and not pushed_in[0]:
            hi_res_mode = not hi_res_mode
            scroller = Scroller('hi' if hi_res_mode else 'lo')
            scroller.reset()
            grid.bytes_array(scroller.up())
            disp_timer_expiration = now + datetime.timedelta(seconds=2)
            scroller_timer_expiration = now + datetime.timedelta(seconds=2)
            disp_needs_updating = True
            pushed_in[0] = True

        # Switch 'setting switcher' and 'setting b'
        if push[1] and not pushed_in[1]:
            setting_switcher = not setting_switcher
            scroller = Scroller('set' if setting_switcher else 'b')
            scroller.reset()
            grid.bytes_array(scroller.up())
            disp_timer_expiration = now + datetime.timedelta(seconds=2)
            scroller_timer_expiration = now + datetime.timedelta(seconds=SCROLLER_PRE_DELAY)
            disp_needs_updating = True