def on_buttons_ab_click(): global vol if vol >= 40: vol = 0 else: vol = 40 input.buttons_ab.on_event(ButtonEvent.CLICK, on_buttons_ab_click) def board(): if strip_mode == 0 or strip_mode == 2: if col_type == True: strip.set_pixel_color(count, list2[list_val]) else: strip.set_pixel_color(count, list2[randint(0, 9)]) pause(dly) strip.clear() def reverse(): global count count = 10 for index in range(10): count += -1 music.ring_tone(400 + count * 10) board() ext_board() music.set_volume(0) def on_button_a_click(): global list_val list_val += 1 if list_val > 9: list_val = 0 input.button_a.on_event(ButtonEvent.CLICK, on_button_a_click) def forward(): global count count = -1 for index2 in range(10): count += 1 music.ring_tone(700 + count * 60) board() ext_board() music.set_volume(0) def on_button_b_click(): global col_type if col_type == True: col_type = False else: col_type = True input.button_b.on_event(ButtonEvent.CLICK, on_button_b_click) def ext_board(): if strip_mode == 1 or strip_mode == 2: if col_type == True: strip2.set_pixel_color(count, list2[list_val]) else: strip2.set_pixel_color(count, list2[randint(0, 9)]) pause(dly) strip2.clear() acc_y = 0 list2: List[number] = [] vol = 0 strip_mode = 0 col_type = False dly = 0 list_val = 0 count = 0 strip2: light.NeoPixelStrip = None strip: light.NeoPixelStrip = None acc_xyz = 0 strip = light.onboard_strip() strip2 = light.create_strip(pins.A1, 12) count = 0 list_val = 0 dly = 0 col_type = True strip_mode = 0 vol = 40 list2 = [Colors.RED, Colors.ORANGE, Colors.YELLOW, Colors.GREEN, Colors.BLUE, Colors.INDIGO, Colors.VIOLET, Colors.PURPLE, Colors.PINK, Colors.WHITE] def on_forever(): global dly, acc_y dly = Math.round(Math.map(input.acceleration(Dimension.STRENGTH), 2046, 0, 0, 100)) acc_y = input.acceleration(Dimension.Y) if dly >= 45: if strip_mode == 0: strip.clear() else: strip2.clear() else: music.set_volume(vol) if acc_y >= 10: forward() if acc_y <= -10: reverse() forever(on_forever)