Makuna / NeoPixelBus

An Arduino NeoPixel support library supporting a large variety of individually addressable LEDs. Please refer to the Wiki for more details. Please use the GitHub Discussions to ask questions as the GitHub Issues feature is used for bug tracking.
GNU Lesser General Public License v3.0
1.18k stars 263 forks source link

Doesn't compile on Arduino IDE V2.3.2 for an RP2040. #816

Open FlightDataRecorder opened 3 months ago

FlightDataRecorder commented 3 months ago

Installed NeoPixelBus V2.8.0, tried to compile NeoPixel_RP2040_PioX4.ino and it blows up on these lines...

NeoPixelBus<NeoBgrFeature, NeoRp2040Pio1X4Ws2811Method> strip1(120, 15); // note: older WS2811 and longer strip NeoPixelBus<NeoGrbFeature, NeoRp2040Pio1X4Ws2812xMethod> strip2(100, 2); // note: modern WS2812 with letter like WS2812b NeoPixelBus<NeoGrbFeature, NeoRp2040Pio1X4Ws2812xInvertedMethod> strip3(100, 4); // note: inverted NeoPixelBus<NeoGrbwFeature, NeoRp2040Pio1X4Sk6812Method> strip4(50, 16); // note: RGBW and Sk6812 and smaller strip

If I comment the each one out it just crashes on the next one complaining that NeoRp2040Pio1X4Ws2811Method was not declared in this scope.

Any help would be appreciated; I went and bought ~$150 worth of SK6812 Strips and Power Supplies based on this page https://www.arduino.cc/reference/en/libraries/neopixelbus-by-makuna/ saying "This library is compatible with ALL architectures."

Thank you.

Makuna commented 3 months ago

The example was not updated after changes for RP2040 name convention was moved to the modern pattern. Try these (copy and paste into the sketch to replace the definitions).

NeoPixelBus<NeoBgrFeature, Rp2040x4Pio1Ws2811Method> strip1(120, 15); // note: older WS2811 and longer strip
NeoPixelBus<NeoGrbFeature, Rp2040x4Pio1Ws2812xMethod> strip2(100, 2); // note: modern WS2812 with letter like WS2812b
NeoPixelBus<NeoGrbFeature, Rp2040x4Pio1Ws2812xInvertedMethod> strip3(100, 4); // note: inverted
NeoPixelBus<NeoGrbwFeature, Rp2040x4Pio1Sk6812Method> strip4(50, 16); // note: RGBW and Sk6812 and smaller strip

The example needs to be updated is all.

FlightDataRecorder commented 3 months ago

Makuna;

Thanks so much! That was it! As simple as that change was, not being familiar with the project I had absolutely no idea where to start to figure that out by my self.

I almost never support things like this, but I have also never got personal overnight service like that; so I made a donation to support this project.

Also, are there any issues running NeoPixelBus on the 2nd Core of an RP2040? (i.e. Setup1 and Loop1.)

Thanks again! FlightDataRecorder

Makuna commented 3 months ago

Also, all the examples will work with RP2040 (should). This sepecific one demonstrates the longer names so you can use different PIO hardware if you need.

The default method names like NeoWs2812xMethod are just an alias for respective names like Rp2040x4Pio1Ws2812xMethod. They use the PIO 1. So, this will work also...

NeoPixelBus<NeoBgrFeature, NeoWs2811Method> strip1(120, 15); // note: older WS2811 and longer strip
NeoPixelBus<NeoGrbFeature, NeoWs2812xMethod> strip2(100, 2); // note: modern WS2812 with letter like WS2812b
NeoPixelBus<NeoGrbFeature, NeoWs2812xInvertedMethod> strip3(100, 4); // note: inverted
NeoPixelBus<NeoGrbwFeature, NeoSk6812Method> strip4(50, 16); // note: RGBW and Sk6812 and smaller strip

Each PIO can support four instances of the NeoPixelBus, so if you are not using PIO for anything else on your project, you can have 8 channels to achieve some impressive fast and big displays. Memory becomes the real issue then.