pi_pico_neopixel icon indicating copy to clipboard operation
pi_pico_neopixel copied to clipboard

Multiple outputs

Open tloose opened this issue 3 years ago • 2 comments

I'm interested in running 3 or 4 PIO channels at the same time driving WS2812 chains. I have seen the article about using one PIO and a shift register to drive up to 8 chains; I'd prefer to avoid the extra hardware and code to 'slice' the LED data. Has anyone run multiple PIOs to drive individual I/O pins?

tloose avatar Sep 06 '22 17:09 tloose

https://github.com/adafruit/Adafruit_Blinka/issues/103#issuecomment-750945101

Seems the pico has a fundamental issue when it comes to controlling two separate PWM signals at once, which means multiple strips will require the PIO. I'd love for that to be wrong though...

Lemcott avatar Oct 10 '22 01:10 Lemcott

So, I'm not entirely sure if I understand this right, but you can use different PIOs to achieve this. Just make two objects, each for separate PIO, for example:

strip = Neopixel(num_leds=29, state_machine=0, pin=0, mode="RGBW")
strip2 = Neopixel(num_leds=60, state_machine=1, pin=1, mode="GRB")

Where you specify different PIO IDs "state_machine" and output pin (you can of course do same without using parameter names, they are just added for more clarity). Above example enables you to have separate strips on pin 0 and 1, each having its own memory for colors and dedicated PIO.

Hope this helps :)

blaz-r avatar Oct 16 '22 13:10 blaz-r

I've tried initializing multiple strips in one script before, but I've had no luck. It keeps giving me a RuntimeError saying "Raspberry Pi neopixel support is for one strip only!" The only workaround I've been able to get to to work so far is to have two different scripts, each initializing and driving a different strip, then having both scripts running simultaneously, although separately. Idk why I can't control both strips in the same script, but I hope this workaround helps. I would like to see native support for multiple strips in the same script added at some point though.

ShadowGamer3 avatar Nov 03 '22 15:11 ShadowGamer3

I've tried initializing multiple strips in one script before, but I've had no luck. It keeps giving me a RuntimeError saying "Raspberry Pi neopixel support is for one strip only!" The only workaround I've been able to get to to work so far is to have two different scripts, each initializing and driving a different strip, then having both scripts running simultaneously, although separately. Idk why I can't control both strips in the same script, but I hope this workaround helps. I would like to see native support for multiple strips in the same script added at some point though.

Library in this repo (pi_pico_neopixel) does support running more strips in single script as I have said above. Judging by the error message, I think your issue is regarding Adafruit (as linked above by Lemcott), which is not part of this repository.

blaz-r avatar Nov 03 '22 15:11 blaz-r

Closing due to inactivity.

blaz-r avatar Apr 17 '23 10:04 blaz-r