Exemplo n.º 1
0
def each(each):
    """Lights the string according to the defined colors for each pixel passed in.
    
    Param each: List of tuples containing r, g, b values for each respective pixel in order."""
    
    np.set_pixels(each)
    np.show()
Exemplo n.º 2
0
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)
Exemplo n.º 3
0
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)
Exemplo n.º 4
0
def slide(speed = 1):
    """The full color spectrum is shown and it "slides"/translates across the string

    Param speed: How fast it slides. Scales the default speed."""
    global stop_event
    off = 0
    while(not stop_event.is_set()):
        for n in range(0, np.LED_COUNT):
            np.set_pixel_hsv(n, ((n+off)/60.0)%1, 1, 1)
        off+=.1
        np.show()
        stop_event.wait(.05/speed)
Exemplo n.º 5
0
def disco(speed=1):
    """Pattern formed when the color spectrum is repeated and condensed, then reversed
    
    Param speed: Scales the default speed."""

    global stop_event
    off = 0
    while not stop_event.is_set():
        for n in range(0, np.LED_COUNT):
            np.set_pixel_hsv(n, ((n*off)/float(np.LED_COUNT))%1, 1, 1)
        off+=.1
        np.show()
        stop_event.wait(.05/speed)
Exemplo n.º 6
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)
Exemplo n.º 7
0
def cycle(speed=1):
    """Cycles through the color spectrum. Entire string is the same color.
    
    Param speed: Scales the default speed."""

    global stop_event
    while not stop_event.is_set():
        for h in range(0, 1000):
            if stop_event.is_set():
                break
            np.set_all_pixels_hsv(h/1000.0, 1, 1)
            np.show()
            stop_event.wait(.05/speed)
Exemplo n.º 8
0
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)
Exemplo n.º 9
0
def chase(speed = 1):
    """Each light sequentially lights up a color untill the string is filled with that color,
    then it is repeated with the next color. Each color is .2 hue away in HSV.

    Param speed: Scales the default speed."""

    global stop_event
    hue = 0;
    while not stop_event.is_set():
        for n in range(0, np.LED_COUNT):
            if stop_event.is_set():
                break
            np.set_pixel_hsv(n, hue, 1, 1)
            np.show()
            stop_event.wait(.05/speed)
        hue += .2
        hue %= 1
Exemplo n.º 10
0
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)
Exemplo n.º 11
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)
Exemplo n.º 12
0
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)
Exemplo n.º 13
0
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()