Raspberry Pi Python Neopixel WS281x Script suddenly changes LED color

338 Views Asked by At

For my Python script I'M using this library. I try to set one single, permanent color to all my 60 pixels. As I'm using two LED strips (one strip at GPIO18 and one at GPIO 13), my code handels both of them simultaniously.

The problem is that the code changes the pixel colors one pixel after another and somewhere inbetween the led color changes to white for all the 2 x 60 leds.

So for example: The first 53 LEDs on both strips get the right color and in a split second, all leds are white and stay white.

The weird thing ist that I think it has something to do with the color itself. The color Color(0,0,255) works flawlessly. But my color Color(100,149,237) has this weird behaviour.

def colorBlue(wait_ms=20):
    """Static Color Blue."""
    global strip1
    global strip2

    for i in range(0, strip1.numPixels(), 1):
        strip1.setPixelColor(i, Color(100,149,237))
        strip1.show()
        time.sleep(wait_ms / 500.0)
        strip2.setPixelColor(i, Color(100,149,237))
        strip2.show()
        time.sleep(wait_ms / 500.0)

What do I need to change in my in my code to fix this and keep the color stable?

0

There are 0 best solutions below