def flash(speed = 1): """All lights display the same color and change every second(by default). Param speed: Scales the default speed.""" while not stop_event.is_set(): color = [random.randint(0, 255), random.randint(0, 255), random.randint(0, 255)] np.set_all_pixels(color[0], color[1], color[2]) np.show() stop_event.wait(1/speed)
def strobe(speed=1, color = (255, 255, 255)): """Entire string flashes rapidly. Param speed: Scales the default speed. Param r, g, b: Default white. RGB values for light color. [0, 255]""" global stop_event while(not stop_event.is_set()): np.set_all_pixels(color[0], color[1], color[2]) np.show() stop_event.wait(.1/speed) np.off() stop_event.wait(.1/speed)
def throb(speed=1, color=(255, 255, 255)): """Entire string cycles through brightness levels. Starts off, gradually gets brighters, the darker, and repeats. Param speed: Scales the default speed. Param r, g, b: Default white. RGB values for light color. [0, 255]""" global stop_event np.set_all_pixels(color[0], color[1], color[2]) brightness = 0 db = .01 while(not stop_event.is_set()): np.brightness(brightness) np.show() if brightness + db > 1 or brightness + db < 0: db = -db brightness += db stop_event.wait(.01/speed) np.brightness(1)
def on(color = (255, 255, 255)): """Turns the entire string on. Param r, g, b: Default white. RGB values for light color. [0, 255]""" np.set_all_pixels(color[0], color[1], color[2]) np.show()