Beispiel #1
0
def chase_loop(strip, step_time=0.03, timeout=None, current=None):
    if current is None:
        set_all(strip, neopixel.Color(0, 0, 0))
    else:
        to_target(strip, current, defaultdict(lambda: (0, 0, 0)))
    start_time = time()

    gradient_length = 10
    max_brightness = 255
    offset = gradient_length
    brightness_gradient = [0] * (strip.numPixels() - gradient_length) + [
        int(round(i**2 * max_brightness / gradient_length**2))
        for i in range(1, gradient_length + 1)
    ]

    color_gradient = full_color_gradient(strip.numPixels(), 100)
    while True:
        step_t0 = time()
        current = {}
        for i in range(strip.numPixels()):
            current[i] = brightness_gradient[
                (i - offset) % strip.numPixels()] * color_gradient[i] / 100
            strip.setPixelColor(
                i,
                neopixel.Color(int(current[i][0]), int(current[i][1]),
                               int(current[i][2])))
        strip.show()
        elapsed = time() - step_t0
        if elapsed < step_time:
            sleep(step_time - elapsed)
        if timeout is not None and time() - start_time >= timeout:
            return current
        offset += 1
Beispiel #2
0
    def run(self):
        while not self.stopped():
            janim.colorWipe(self.strip,
                            neopixel.Color(255, 0, 0),
                            func=self.stopped)  # Red wipe
            janim.colorWipe(self.strip,
                            neopixel.Color(0, 255, 0),
                            func=self.stopped)  # Blue wipe
            janim.colorWipe(self.strip,
                            neopixel.Color(0, 0, 255),
                            func=self.stopped)  # Green wipe

            if 1:
                janim.rainbow_leftright(self.strip,
                                        1,
                                        dir=20,
                                        func=self.stopped)
                janim.rainbow_leftright(self.strip,
                                        1,
                                        dir=20,
                                        func=self.stopped)
                janim.rainbow_leftright(self.strip,
                                        1,
                                        dir=-20,
                                        func=self.stopped)
                janim.rainbow_center(self.strip, 1, dir=20, func=self.stopped)
                janim.rainbow_center(self.strip, 1, dir=-20, func=self.stopped)
                janim.rainbow_updown(self.strip, 1, dir=20, func=self.stopped)
                janim.rainbow_updown(self.strip, 1, dir=-20, func=self.stopped)
Beispiel #3
0
def running(strip):
    i = 0
    while True:
        i = (i + 1) % strip.numPixels()
        set_all(strip, neopixel.Color(0, 0, 0))
        strip.setPixelColor(i, neopixel.Color(30, 0, 0))
        strip.show()
        sleep(0.3)
Beispiel #4
0
def lat_sweep(strip, leds):
    for alt in itertools.cycle([300, 800, 1500, 3000]):
        for deltalat in np.linspace(-2, 2, 20):
            _, ledid, _ = leds.closest_led(leds.lat + deltalat, leds.long, alt)
            set_all(strip, neopixel.Color(0, 0, 0))
            strip.setPixelColor(int(ledid), neopixel.Color(30, 0, 0))
            strip.show()
            sleep(0.2)
Beispiel #5
0
 def set_led_states(self, led_states):
     for i, state in enumerate(led_states):
         if (self.px_order == 'GRB'):
             self.leds.setPixelColor(
                 i, neopixel.Color(state[1], state[0], state[2]))
         else:
             self.leds.setPixelColor(
                 i, neopixel.Color(state[0], state[1], state[2]))
     self.leds.show()
def wheel(pos):
    """Generate rainbow colors across 0-255 positions."""
    if pos < 85:
        return neopixel.Color(pos * 3, 255 - pos * 3, 0)
    elif pos < 170:
        pos -= 85
        return neopixel.Color(255 - pos * 3, 0, pos * 3)
    else:
        pos -= 170
        return neopixel.Color(0, pos * 3, 255 - pos * 3)
Beispiel #7
0
    def axis_test(self):
        electric = neo.Color(126, 249, 255)
        tiger = neo.Color(253, 106, 2)
        black = neo.Color(0, 0, 0)
        royal = neo.Color(29, 41, 81)

        for i in range(self.width):
            self.set(self.get_column_coords(i), [tiger]*i + [electric]*(self.height-i))    
        
        self.draw()
Beispiel #8
0
def All():
    for j in range(256):
        for i in range(LED_COUNT):
            if i % 3 == 1:
                SetColor(strip, i, neopixel.Color(j, 0, 255 - j),
                         1)  #Blue ~ Red
            if i % 3 == 2:
                SetColor(strip, i, neopixel.Color(255 - j, j, 0),
                         1)  #Red ~ Green
            if i % 3 == 0:
                SetColor(strip, i, neopixel.Color(0, 255 - j, j),
                         1)  #Green ~ Blue
    for j in range(256):
        for i in range(LED_COUNT):
            if i % 3 == 1:
                SetColor(strip, i, neopixel.Color(255 - j, j, 0),
                         1)  #Red ~ Green
            if i % 3 == 2:
                SetColor(strip, i, neopixel.Color(0, 255 - j, j),
                         1)  #Green ~ Blue
            if i % 3 == 0:
                SetColor(strip, i, neopixel.Color(j, 0, 255 - j),
                         1)  #Blue ~ Red
    for j in range(256):
        for i in range(LED_COUNT):
            if i % 3 == 1:
                SetColor(strip, i, neopixel.Color(0, 255 - j, j),
                         1)  #Green ~ Blue
            if i % 3 == 2:
                SetColor(strip, i, neopixel.Color(j, 0, 255 - j),
                         1)  #Blue ~ Red
            if i % 3 == 0:
                SetColor(strip, i, neopixel.Color(255 - j, j, 0),
                         1)  #Red ~ Green
Beispiel #9
0
def All():
    for j in range(256):
        for i in range(LED_COUNT):
            if i % 3 == 1:  # Blue ~ Red
                SetColor(strip, i, neopixel.Color(j, 0, 255 - j), 1)
            if i % 3 == 2:  # Red ~ Green
                SetColor(strip, i, neopixel.Color(255 - j, j, 0), 1)
            if i % 3 == 0:  # Green ~ Blue
                SetColor(strip, i, neopixel.Color(0, 255 - j, j), j)
    for j in range(256):
        for i in range(LED_COUNT):
            if i % 3 == 1:  # Red ~ Green
                SetColor(strip, i, neopixel.Color(255 - j, j, 0), 1)
            if i % 3 == 2:  # Green ~ Blue
                SetColor(strip, i, neopixel.Color(0, 255 - j, j), 1)
            if i % 3 == 0:  # Blue ~ Red
                SetColor(strip, i, neopixel.Color(j, 0, 255 - j), 1)
    for j in range(256):
        for i in range(LED_COUNT):
            if i % 3 == 1:  # Green ~ Blue
                SetColor(strip, i, neopixel.Color(0, 255 - j, j), 1)
            if i % 3 == 2:  # Blue ~ Red
                SetColor(strip, i, neopixel.Color(j, 0, 255 - j), 1)
            if i % 3 == 0:  # Red ~ Green
                SetColor(strip, i, neopixel.Color(255 - j, j, 0), 1)
Beispiel #10
0
def OneByOne():
    for i in range(LED_COUNT):
        if i % 3 == 1:
            for j in range(256):  # Blue to RED
                SetColor(strip, i, neopixel.Color(j, 0, 255 - j), 1)
            for j in range(256):  # RED to GREEN
                SetColor(strip, i, neopixel.Color(255 - j, j, 0), 1)
            for j in range(256):  # Green to Blue
                SetColor(strip, i, neopixel.Color(0, 255 - j, j), 1)

        if i % 3 == 2:
            for j in range(256):  # RED to GREEN
                SetColor(strip, i, neopixel.Color(255 - j, j, 0), 1)
            for j in range(256):  # Green to Blue
                SetColor(strip, i, neopixel.Color(0, 255 - j, j), 1)
            for j in range(256):  # Blue to RED
                SetColor(strip, i, neopixel.Color(j, 0, 255 - j), 1)

        if i % 3 == 0:
            for j in range(256):  # Green to Blue
                SetColor(strip, i, neopixel.Color(0, 255 - j, j), 1)
            for j in range(256):  # Blue to RED
                SetColor(strip, i, neopixel.Color(j, 0, 255 - j), 1)
            for j in range(256):  # RED to GREEN
                SetColor(strip, i, neopixel.Color(255 - j, j, 0), 1)
Beispiel #11
0
def All():
    for j in range(256):
        for i in range(LED_COUNT):
            if i % 3 == 1:
                SetColor(strip, i, neopixel.Color(j, 0, 255 - j), 1)
            if i % 3 == 2:
                SetColor(strip, i, neopixel.Color(0, 255 - j, j), 1)
            if i % 3 == 0:
                SetColor(strip, i, neopixel.Color(0, 255 - j, j), 1)
    for j in range(256):
        for i in range(LED_COUNT):
            if i % 3 == 1:
                SetColor(strip, i, neopixel.Color(255 - j, j, 0), 1)
            if i % 3 == 2:
                SetColor(strip, i, neopixel.Color(0, 255 - j, j), 1)
            if i % 3 == 0:
                SetColor(strip, i, neopixel.Color(j, 0, 255 - j), 1)
    for j in range(256):
        for i in range(LED_COUNT):
            if i % 3 == 1:
                SetColor(strip, i, neopixel.Color(0, 255 - j, j), 1)
            if i % 3 == 2:
                SetColor(strip, i, neopixel.Color(j, 0, 255 - j), 1)
            if i % 3 == 0:
                SetColor(strip, i, neopixel.Color(255 - j, j, 0), 1)
def IndicateHealthPoints(HealthPoints, Strip):
	global strip 
	
	HealthPixels = round(HealthPoints/25)
	
	if (HealthPoints >0 and HealthPixels == 0):
		HealthPixels = 1
	
	print (HealthPoints)
	if (HealthPoints > 85):
		PixelColour = VERY_HEALTHY_COLOUR
	elif (HealthPoints >=60 and HealthPoints <=85):
		PixelColour = DAMAGED_COLOUR	
	elif (HealthPoints >=0 and HealthPoints <60):
		PixelColour = DANGER_COLOUR
	elif (HealthPoints<0):
		PixelColour = KO_COLOUR
		
	if (Strip ==0):
		if (PixelColour == KO_COLOUR):
			for i in range (7, -1 ,-1):
				strip.setPixelColor(i, neopixel.Color(0,0,0)) 
			strip.show()
			time.sleep(.3)
			for i in range (7, -1 ,-1):
				strip.setPixelColor(i, PixelColour) # Indicate Knock Out
			
		# Otherwise indicate health
		else:
		
			# Otherwise indicate health
			for i in range (7, 7 - HealthPixels ,-1):
				strip.setPixelColor(i, PixelColour) 
			for i in range (7-HealthPixels,-1 ,-1):
				strip.setPixelColor(i, neopixel.Color(0,0,0)) 

	elif (Strip ==1):
		if (PixelColour == KO_COLOUR):
			for i in range (8, 16):
				strip.setPixelColor(i, neopixel.Color(0,0,0)) # Indicate Knock Out
			strip.show()
			time.sleep(.3)
			for i in range (8, 16):
				strip.setPixelColor(i, PixelColour) # Indicate Knock Out
		else:	
			for i in range (8, 8 + HealthPixels):
				strip.setPixelColor(i, PixelColour) 
			for i in range (8+HealthPixels,16 ,1):
				strip.setPixelColor(i, neopixel.Color(0,0,0)) # Turn pixel white when finished

	strip.show()
Beispiel #13
0
def getColor(responseTime):
    '''
    Input: Takes in an integer responseTime
    Output: Returns an RGB tuple for the corresponding color to ping rate
    '''
 
    if responseTime <= 50:
        return neopixel.Color(0,255,0) #GREEN
    elif responseTime > 50 and responseTime <= 100:
        return neopixel.Color(125,255,0) #LIGHT GREEN
    elif responseTime > 100 and responseTime <= 150:
        return neopixel.Color(255,255,0) #YELLOW
    else:
        return neopixel.Color(255,0,0) #RED
Beispiel #14
0
def rings_loop(strip, step_time=0.25, timeout=None, current=None):
    if current is None:
        set_all(strip, neopixel.Color(0, 0, 0))
        current = defaultdict(lambda: (0, 0, 0))
    start_time = time()

    colors = [
        np.array(hsl_to_rgbnorm(h, 1, 0.5)) * 100
        for h in np.linspace(0, 360, 4 * 4)
    ]
    shuffle(colors)

    offset = 0
    while True:
        target = defaultdict(lambda: (0, 0, 0))
        for level in range(4):
            for ringid, ring in enumerate(RINGS):
                for l in ring:
                    target[l + level * LEVEL_LEDN] = colors[(level + offset +
                                                             ringid) % (4 * 4)]
        current = to_target(strip, current, target, step_time)

        if timeout is not None and time() - start_time >= timeout:
            return current

        offset += 1
Beispiel #15
0
def proc_input(dat):
	global strip
	global arr
	global count

	count += 1

	n = len(dat)//3
	if n>maxLED:
		n=maxLED
	ol = list()
	if arr is None:
		arr=list()
	while len(arr) < 3*n:
		arr.append(0)

	for i in xrange(0,3*n,3):
		# get 8-bit values
		c24 = dat[i:i+3]
		arr[i+0] = ord(c24[0])
		arr[i+1] = ord(c24[1])
		arr[i+2] = ord(c24[2])

	# filter .....
	arr = fix_and_filter(arr)

	# send to neopixel
	for i in xrange(0,3*n,3):
		strip.setPixelColor(i//3,neopixel.Color( * arr[i:i+3] ))

	strip.show()
Beispiel #16
0
def init():
    from main import LedArray
    LED_COUNT = 37 * 4  # Number of LED pixels.
    LED_PIN = 18  # GPIO pin connected to the pixels (18 uses PWM!).
    # LED_PIN        = 10      # GPIO pin connected to the pixels (10 uses SPI /dev/spidev0.0).
    LED_FREQ_HZ = 800000  # LED signal frequency in hertz (usually 800khz)
    LED_DMA = 11  # DMA channel to use for generating signal (try 10)
    LED_BRIGHTNESS = 50  # Set to 0 for darkest and 255 for brightest
    LED_INVERT = False  # True to invert the signal (when using NPN transistor level shift)
    LED_CHANNEL = 0  # set to '1' for GPIOs 13, 19, 41, 45 or 53
    strip = neopixel.Adafruit_NeoPixel(LED_COUNT,
                                       LED_PIN,
                                       LED_FREQ_HZ,
                                       LED_DMA,
                                       LED_INVERT,
                                       LED_BRIGHTNESS,
                                       LED_CHANNEL,
                                       strip_type=neopixel.ws.WS2811_STRIP_GRB)

    # Intialize the library (must be called once before other functions).
    strip.begin()
    set_all(strip, neopixel.Color(0, 0, 0))

    here = (48.224708, 16.438082)  # lat long

    leds = LedArray([49.0, 32.0, 16.5, 0.0], [18, 12, 6, 1], [
        -np.pi / 2 + np.deg2rad(10), -np.pi / 2, -np.pi / 2 - np.deg2rad(30), 0
    ], [1, -1, -1, 1], 200, *here, [500, 1000, 2500])

    return strip, leds
Beispiel #17
0
def on_message(client, userdata, message):
    s = message.payload.decode('utf-8').split('|')
    print(s[-1])
    if s[-1] == 'on':
        print('light on!!')
        colorWipe(strip, neopixel.Color(0, 0, 255), 10)
        time.sleep(0.5)
        client.publish(topic_pub, str(device_id) + '@action|success')
    elif s[-1] == 'off':
        print('light off!!')
        colorWipe(strip, neopixel.Color(0, 0, 0), 10)
        time.sleep(0.5)
        client.publish(topic_pub, str(device_id) + '@action|success')
    else:
        print(s[-1])
        print('The message is none')
Beispiel #18
0
 def run(self):
     print('DisplayShowPlaylistThread - run')
     print(self.playlist)
     while not self.stopped():
         for entry in self.playlist:
             print('entry:', entry)
             if (entry['type'] == 'image'):
                 # play a gif here
                 janim.animated_gif(self.strip,
                                    entry['name'],
                                    func=self.stopped,
                                    repeat=entry['repeat'])
             elif (entry['type'] == 'colorwipe'):
                 janim.colorWipe(self.strip,
                                 neopixel.Color(255, 0, 0),
                                 func=self.stopped)  # Red wipe
             elif (entry['type'] == 'rainbow'):
                 janim.rainbow_leftright(self.strip,
                                         1,
                                         dir=20,
                                         func=self.stopped)
             elif (entry['type'] == 'text'):
                 janim.scroll_text(self.strip,
                                   entry['name'],
                                   textcolor=(int(entry['r']),
                                              int(entry['g']),
                                              int(entry['b'])),
                                   func=self.stopped)
Beispiel #19
0
def spinning_loop(strip, step_time=0.1, timeout=None, current=None):
    if current is None:
        set_all(strip, neopixel.Color(0, 0, 0))
        current = defaultdict(lambda: (0, 0, 0))
    start_time = time()

    max_brightness = 255
    brightness_gradients = [[
        int(round(i**2 * max_brightness / gradient_length**2))
        for i in range(1, gradient_length + 1)
    ] for gradient_length in RING_LEDNS]

    color_gradient = full_color_gradient(strip.numPixels(), 100)

    offset = 0
    while True:
        target = {}
        for level in range(4):
            for ring_id, ring in enumerate(RINGS):
                direction = (1 - 2 * ((ring_id + level) % 2))
                for led_ring_id, led_level_id in enumerate(ring):
                    led_id = led_level_id + level * LEVEL_LEDN
                    target[led_id] = (brightness_gradients[ring_id][
                        ((led_ring_id - direction * offset) * direction) %
                        RING_LEDNS[ring_id]] * color_gradient[led_id] / 100)
        current = to_target(strip, current, target, step_time)

        if timeout is not None and time() - start_time >= timeout:
            return current

        offset += 1
Beispiel #20
0
def to_target(strip, current, target, switch_time=0.5, step_time=1 / 30.):
    tot_t0 = time()
    step = defaultdict(lambda: (0, 0, 0))
    for i in range(strip.numPixels()):
        step[i] = tuple((t - c) / (switch_time / step_time)
                        for t, c in zip(target[i], current[i]))

    for _ in range(math.ceil(switch_time / step_time)):
        t0 = time()
        for i in range(strip.numPixels()):
            current[i] = tuple(c + s for c, s in zip(current[i], step[i]))
            if any((s < 0 and c < t) or (s > 0 and c > t)
                   for s, c, t in zip(step[i], current[i], target[i])):
                step[i] = (0, 0, 0)
                current[i] = target[i]
            color_int = tuple(int(round(c)) for c in current[i])

            # cut off at low intensity to remove perceived flicker
            # using gamma correction would be better maybe?
            color_int = tuple(0 if c < 10 and s < 0 else c
                              for c, s in zip(color_int, step[i]))
            strip.setPixelColor(i, neopixel.Color(*color_int))

        strip.show()
        t1 = time()
        if t1 - t0 < step_time:
            sleep(step_time - (t1 - t0))
        else:
            print("too slow!")
    # print("{:.3f}s transition".format(time()-tot_t0))
    return current
Beispiel #21
0
 def check_value(arg, value):
     if 'color' in arg and 'wipe' not in arg:
         # convert color RGB values to 24 bit number
         return neopixel.Color(self, value[0], value[1], value[2])
     if 'iterations' in arg:
         return value[0]
     if 'wait_ms' in arg:
         return value[0]
     return value
Beispiel #22
0
 def __init__(self, num_leds, led_pin, led_data_rate, led_dma_channel,
              led_pixel_order):
     self.leds = neopixel.Adafruit_NeoPixel(num_leds, led_pin,
                                            led_data_rate, led_dma_channel,
                                            False, 255)
     self.px_order = led_pixel_order
     self.leds.begin()
     for i in range(num_leds):
         self.leds.setPixelColor(i, neopixel.Color(0, 0, 0))
     self.leds.show()
Beispiel #23
0
def setpixel():
    x = int(bottle.request.query.get('x'))
    y = int(bottle.request.query.get('y'))
    r = int(bottle.request.query.get('r'))
    g = int(bottle.request.query.get('g'))
    b = int(bottle.request.query.get('b'))

    if app.strip:
        setp(app.strip, x, y, neopixel.Color(g, r, b))
        app.strip.show()

    return "setpixel"
Beispiel #24
0
def init():
    from main import led_strip_from_constants, led_array_from_constants

    strip = led_strip_from_constants()

    # Intialize the library (must be called once before other functions).
    strip.begin()
    set_all(strip, neopixel.Color(0, 0, 0))

    leds = led_array_from_constants()

    return strip, leds
Beispiel #25
0
 def draw_char(self, char, x_pos, y_pos):
     char_num = ord(char) - 32
     # Loop over x direction.
     for x in range(selected_font[font_data.FONT_TUPLE_X]):
         # Loop over y direction.
         for y in range(selected_font[font_data.FONT_TUPLE_Y]):
             # Character position in font table.
             char_pos = (char_num *
                         selected_font[font_data.FONT_TUPLE_X]) + x
             if selected_font[font_data.FONT_TUPLE_CH][char_pos] & 1 << y:
                 self.color = neopixel.Color(self.red, self.green,
                                             self.blue)
                 self.set_pixel(x + x_pos, y + y_pos, self.color)
Beispiel #26
0
def fun_led(req):
	if req.fun == "green":
		color = neopixel.Color(255,0,0)
		for i in range(0,LED_COUNT):
		        neopixel.strip.setPixelColor(i,color)
		        neopixel.strip.show()
	elif req.fun == "red":
                color = neopixel.Color(0,255,0)
                for i in range(0,LED_COUNT):
                        neopixel.strip.setPixelColor(i,color)
                        neopixel.strip.show()
	elif req.fun == "blue":
		color = neopixel.Color(0,0,255)
                for i in range(0,LED_COUNT):
                        neopixel.strip.setPixelColor(i,color)
                        neopixel.strip.show()
	elif req.fun == "off":
		color = neopixel.Color(0,0,0)
                for i in range(0,LED_COUNT):
                        neopixel.strip.setPixelColor(i,color)
                        neopixel.strip.show()

	return True
Beispiel #27
0
def shutdown():
    """
    switch the system off
    """

    global _strip
    for i in range(_strip.numPixels()):
        _strip.setPixelColor(i, neopixel.Color(0, 0, 0))
    _strip.show()

    audio_off()
    gpio.cleanup()

    print 'sys lamp: shut down.'
Beispiel #28
0
def random_loop(strip,
                switch_time=0.5,
                total_brightness=100,
                timeout=None,
                current=None):
    if current is None:
        set_all(strip, neopixel.Color(0, 0, 0))
        current = defaultdict(lambda: (0, 0, 0))
    start_time = time()
    while True:
        target = random_hue_target(strip, tot=total_brightness)
        current = to_target(strip, current, target, switch_time)
        if timeout is not None and time() - start_time >= timeout:
            return current
Beispiel #29
0
def OneByOne():
    for i in range(LED_COUNT):
        if i % 3 == 1:
            for j in range(256):
                SetColor(strip, i, neopixel.Color(j, 0, 255 - j), 1)
            for j in range(256):
                SetColor(strip, i, neopixel.Color(j255 - j, j, 0), 1)
            for j in range(256):
                SetColor(strip, i, neopixel.Color(0, 255 - j, j), 1)
        if i % 3 == 2:
            for j in range(256):
                SetColor(strip, i, neopixel.Color(255 - j, j, 0), 1)
            for j in range(256):
                SetColor(strip, i, neopixel.Color(0, 255 - j.j), 1)
            for j in range(256):
                SetColor(strip, i, neopixel.Color(j, 0, 255 - j), 1)
        if i % 3 == 0:
            for j in range(256):
                SetColor(strip, i, neopixel.Color(0, 255 - j, j), 1)
            for j in range(256):
                SetColor(strip, i, neopixel.Color(j, 0, 255 - j), 1)
            for j in range(256):
                SetColor(strip, i, neopixel.Color(255 - j, j, 0), 1)
Beispiel #30
0
 def show(self, pixels):
     """Writes new LED values to the Raspberry Pi's LED strip
     Raspberry Pi uses the rpi_ws281x to control the LED strip directly.
     This function updates the LED strip with new values.
     """
     # Truncate values and cast to integer
     n_pixels = pixels.shape[1]
     pixels = pixels.clip(0, 255).astype(int)
     # Optional gamma correction
     pixels = _GAMMA_TABLE[pixels]
     # Encode 24-bit LED values in 32 bit integers
     r = np.left_shift(pixels[0][:].astype(int), 8)
     g = np.left_shift(pixels[1][:].astype(int), 16)
     b = pixels[2][:].astype(int)
     rgb = np.bitwise_or(np.bitwise_or(r, g), b)
     # Update the pixels
     for i in range(n_pixels):
         self.strip.setPixelColor(i, neopixel.Color(rgb[i]))
     self.strip.show()