def pattern_1(): # 36 milliseconds + p1_pixel_batch * 1 millisecond global p1_setup, p1_pixel_color if p1_setup: p1_setup = False led.dim = 0.02 for count in range(p1_pixel_batch): led.random_pixel() led.pixel(led.colors[p1_pixel_color], 0, True) p1_pixel_color = "black" if p1_pixel_color == "white" else "white"
def handle_leds(): global step_index step = steps[step_index] step_index = (step_index + 1) % len(steps) for action in step: # print("ACTION: " + str(action)) led_start = action[0] * leds_per_layer led_end = action[1] * leds_per_layer + leds_per_layer color_start = colors[action[2]] color_end = colors[action[3]] for led_index in range(led_start, led_end): led.pixel(color_start, led_index) led.dim = 0.3 led.np.write()
def leds(rear, left=None, right=None): if not left: left = rear if not right: right = rear led.pixel(rear, 0) led.pixel(left, 1) led.pixel(right, 2, True)