Adafruit Neopixel Library [PORTED]

###Just updated the NeoPixel library to support the Photon for all pixel types!
The Spark Core is still supported as well :wink:

Important:

If you have an old app in Build that you are migrating to a Photon or Core, please remove the NeoPixel library from your app and re-apply it to update the included library to v0.0.6. If you are creating a new app for a Photon or Core, simple add the NeoPixel library to your app and you will have the latest v0.0.6.

Live in the Particle Libraries - NeoPixel v0.0.6

https://build.particle.io/libs/5564c41602386e046f00057f/tab/a-rainbow.cpp

Changelog v0.0.5 to v0.0.6:

  • added support for the Photon
  • added .getBrightness()
  • added .clear()
  • refactored .getPixelColor()
  • added a new type of pixel WS2812B2 which is just a different timing method I wanted to explore for WS2812B pixels using the DWT timer. Itโ€™s good and works, but assembly instructions are still more accurate.

Notes:

  • Donโ€™t use getPixelColor() to move pixel data around when you are also using setBrightness(). When the brightness is set, all setPixelColor() calls will end up scaling colors to dim them before they are stored in memory. When using getPixelColor() the stored dimmed color is rescaled back up to the original color. However, due to some loss of precision with the math, it is not possible to recreate this color data perfectly. This is especially true with low brightness values. If you get and set color data repeatedly with a dimmed pixel, it will eventually continue to decrease in value until it is equal to zero.
  • When changing the brightness, always call setPixelColor() first with fresh un-dimmed color data, then call setBrightness(), and finally show().
3 Likes