Пример #1
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)
Пример #2
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)
Пример #3
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
Пример #4
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)