def rave(speed=1): """Each individual light displays a different random color, changing rapidly. Param speed: Scales the default speed.""" global stop_event while(not stop_event.is_set()): for n in range(0, np.LED_COUNT): np.set_pixel(n, random.randint(0, 255), random.randint(0, 255), random.randint(0, 255)) np.show(); stop_event.wait(.1/speed)
def drip(color=(0, 200, 255), speed=1): """Lights increase in brightness randomly, then drop off, making an effect like water dropplets falling Param color: The color of the lights. Defaults to (0, 200, 255), which is a dark teal color. Param speed: Scales the default speed""" dullness = [15]*np.LED_COUNT while not stop_event.is_set(): for n in range(0, np.LED_COUNT): np.set_pixel(n, int(color[0]/dullness[n]), int(color[1]/dullness[n]), int(color[2]/dullness[n])) dullness[n] -= random.random()/20 if dullness[n]<=1 or random.randint(0, int(dullness[n]*20)) == 0: dullness[n] = (random.random()*2)+4 np.show() stop_event.wait(.05/speed)
def christmas(speed=1): """Lights up green and red. Pattern "slides" along the string. Param speed: Scales the default speed""" global stop_event for n in range(0, np.LED_COUNT): x = math.fabs((np.LED_COUNT/2 - n)/float(np.LED_COUNT/2)) np.set_pixel(n, int(255-(x*255)), int(x*255), 0) while(not stop_event.is_set()): first = np.get_pixel(0) for n in range(0, np.LED_COUNT-1): np.set_pixel(n, *np.get_pixel(n+1)) np.set_pixel(np.LED_COUNT-1, *first) np.show() stop_event.wait(.2/speed)