The P2 and Photon 2 now support WS2812, WS2812B, and WS2813 NeoPixels! All you need is Device OS 5.3.2 or later, and Particle-NeoPixel 1.0.3 and you can blink strings of LEDs to your heart’s content.
The RTL872x platform can only use the MOSI pin of SPI or SPI1 (also known as D2) for NeoPixels because it needs to use the DMA controller in the SPI interface to output the pixels fast enough.
Sort of. It was originally forked from the Adafruit NeoPixel library in 2014, but since then the two have diverged, so there will likely be differences.
In theory, the same technique that was used to implement NeoPixels could be used to modify the FastLED library to work on the RTL872x, but as far as I know, no one is working on doing so at this time.
Understood - I have been using FastLED on Arduino and it is much easier to work with to create dynamic effects - more likely to have a cheap arduino device as a sidecar processor/driver to run an LED display than use a P2/Photon2.
Thanks @rickkas7 for updating this library!!! I had hopes to use a NeoPixel Strip with a Photon2/P2 and now it's possible!
One consideration is if you could also update the strandtest.cpp in the examples directory. This might save someone some headaches in the future. Looks like the other examples were updated but not this one.
I personally got hung-up on this a little bit. I just assumed all the updates were in the library itself and as long as I was using the latest library, it should work as desired. Oddly enough the original example from 5 years ago also used D2. From what I can tell you actually have to define the PIXEL_PIN as SPI1 instead of D2 even though it's the same physical PIN. Once I looked at github and saw the other two examples were updated but not the RGBW-StrandTest.cpp was not, I realized my mistake.
Updating the strand test example might save someone else from having similar issues. If you prefer, I can make a pull request to the github repo.
I updated this similar to the other examples and then it worked just fine.
Thanks for the video, Rick! Nice to know it works with Photon 2!
Questions:
1 - Do we need the resistor, or can we directly plug neopixel to the Photon2? (I did this for Photon and it worked well).
2 - Is the library able to be added to the repository that is searched with VS Code? It isn't appearing when I try to add it to the project. I think this would be the easiest way for my students to learn to use NeoPixel with Photon2. If not, is there a tutorial about adding local libraries to VS Code w/Particle extension for Photon2 you can point us to?
The resistor is recommended, but it often works without it. Likewise, powering the the strip with 5V and having the data at 3.3V works sometimes, but not others. This is mostly dependent on the NeoPixels that you have procured, so if it works for one it will probably work for all.