DedeHai / NeoPixelPainter

Arduino library for easy creation of LED strip animations, based on the NeoPixel library.
Other
31 stars 9 forks source link

NeoPixel Painter Library

https://github.com/DedeHai/NeoPixelPainter A library to ease the creation of simple LED-strip animations. See examples for some inspiration.

How to use

The basic principle is to use a brush that can be moved to any pixel. The brush holds a color using the HSV color space rather than RGB. This allows for making colorful animations with color fading as well as brightness fading. To make the brush move on its own, give it a speed and it will move a little on each function call. It only paints each pixel once, even if it stays at the same location for a longer time.

The brush paints on a canvas, which holds one HSV color for each pixel as well as a value to fade to, the fade speed and some fading properties (flags). You should only use one fading type (hue, saturation or value) at a time. Although multiple fadings are allowed, each pixel only holds one 'fade-to' value to not use excessive amounts of RAM. Also, all fading is implemented without the use of floats. This makes it fast and uses a lot less of the precious RAM. The downside is, that color fadings are slightly less accurate but almost indistinguishable to the naked eye because I implemented the fadings using 16bit variables and bit-shifts (aka fixed point arithmetic), making it almost as accurate as when using floats.

Basic procedure

Reference

NeoPixelPainterBrush-Class functions

NeoPixelPainterCanvas-Class functions