rpi-ws281x / rpi-ws281x-python

Python library wrapping for the rpi-ws281x library
BSD 2-Clause "Simplified" License
319 stars 102 forks source link

On a 100-LED 1 meter long LED strip, how to address LEDs 25-75? #75

Closed MainzerKaiser closed 5 months ago

MainzerKaiser commented 2 years ago

Hi all, I adopted the colorwipe function and instead of going in the range(strip.numPixels()):

def colorWipe(strip, color, wait_ms=50):
    for i in range(strip.numPixels()):
        strip.setPixelColor(i, color)
        strip.show()
        time.sleep(wait_ms/1000.0)

... I would like to use the middle N LEDs, e.g. 25-75 if N=50 is chosen. But something like that

def colorWipe(strip, color, wait_ms=50):
    for i in range(25,75,1):
        strip.setPixelColor(i, color)
        strip.show()
        time.sleep(wait_ms/1000.0)

only works up to LED No. 50 and the rest does not react. However, running the original code with 75 LEDs results in the the colorwipe also running from LED 1 to LED 75. Why is that?

Gadgetoid commented 1 year ago

There's no reason why this should be the case, afaik, try v5.0.0 and see if it helps.