Example #1
0
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)
Example #2
0
def bounce(speed=1):
    """Two pixels start on either end and move along the string changing color.
    When the end is hit, they change  direction

    Param speed: Scales the default speed."""
    global stop_event
    x = 0
    dx = .1
    while(not stop_event.is_set()):
        np.off()
        np.set_pixel_hsv(int(x), (x/float(np.LED_COUNT))%1, 1, 1)
        np.set_pixel_hsv(int(np.LED_COUNT-x), ((np.LED_COUNT-x)/float(np.LED_COUNT))%1, 1, 1)
        x+=dx
        if(x+dx >=np.LED_COUNT or x+dx <0):
            dx = -dx
        np.show()
        stop_event.wait(.01/speed)
Example #3
0
def stop():
    """Turns the string off."""
    np.off()