Adafruit ItsyBitsy RP2040 and RP2040-Zero NeoPixel (WS2812) example, using NeoPixelConnect library #756
Replies: 3 comments
-
I now have a Waveshare RP2040-Zero to try this on, so I can confirm it works, just by removing the #define ItsyBitsyRP2040 or commenting it out. I set the board type to Raspberry Pi Pico. I don't know if that's the best way, and I haven't checked if the pin definitions match up properly, but it works fine. I had to do the trick with Zadig #96, to get it to work in Windows 7, as with the Pi Pico, but I was mostly expecting that. It hadn't occurred to me that there's also an Adafruit NeoPixel library. I was originally thinking about the RP2040-Zero, and this was the first NeoPixel library I found that looked suitable. |
Beta Was this translation helpful? Give feedback.
-
The official page for the Waveshare RP2040-Zero is: https://www.waveshare.com/wiki/RP2040-Zero It's a cut down Pico, with even less pins than the Adafruit ItsyBitsy RP2040, but with all four ADC pins available (unlike the Pico). It has the WS2812 aka NeoPixel instead of an onboard LED. If you buy it with all the pins soldered on, they all face down, so it would not be able to fit in a breadboard. I plan to use right angled headers on the 5 end pins, or normal straight headers but facing up, depending on the particular application, then just use DuPont jumper wires. Those are easy to solder on permanently too, once it's a working design - just release the black plastic shell by using a pin under the little tab, and pull gently. You can then push the metal part back on to the header pin, and solder it on. |
Beta Was this translation helpful? Give feedback.
-
Just as a hint for new visitors: The NeoPixelConnect library breaks SerialPIO by not using the framework to get a free state machine; thanks for the clarification here: #1420 As an alternative, I tested Adafruit with SerialPIO simultaneously successfully. |
Beta Was this translation helpful? Give feedback.
-
Adafruit only ever gave an example of how to use the ItsyBitsy RP2040's WS2812 NeoPixel RGB LED in Python, AFAIK. Here's a simple example based on the NeoPixelConnect library, a WS2812 NeoPixel Library For the Arduino Nano RP2040 Connect (https://github.com/MrYsLab/NeoPixelConnect).
You can download that library as a .zip, then install it in the Arduino IDE using the Sketch menu, with Sketch->Insclude Library->Add .ZIP Library.
I've attached the .ino example, which is based on theirs, and pasted it below.
If you comment out the line that says #define ItsyBitsyRP2040 (change it to //define ItsyBitsyRP2040), near the top, it may work for the RP2040-Zero - I don't have any to test it on, yet. [EDIT: I've now confirmed that it works]
It flashes the RGB LED with a pseudo random brightness and colour. I limited the max brightness to 8, but you can set up to 255, which is so bright I was worried it might damage something. The WS2812 on the ItsyBitsy RP2040 is powered directly from a GPIO pin, according to the schematic, but it can draw a lot of current, which is not normally considered healthy for a GPIO pin.
NeoPixelItsyBitsyRP2040_ino.zip
Beta Was this translation helpful? Give feedback.
All reactions