
This library features a variety of blinken effects for the WS2811/WS2812/NeoPixel LEDs. It is meant to be a drop-in replacement for the Adafruit NeoPixel library with additional features.
You can search for WS2812FX in the Arduino IDE Library Manager or install the latest (or development) version manually:
See examples for basic usage.
In it's most simple form, here's the code to get you started!
#include <WS2812FX.h>
#define LED_COUNT 30
#define LED_PIN 12
WS2812FX ws2812fx = WS2812FX(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
void setup() {
ws2812fx.init();
ws2812fx.setBrightness(100);
ws2812fx.setSpeed(200);
ws2812fx.setMode(FX_MODE_RAINBOW_CYCLE);
ws2812fx.start();
}
void loop() {
ws2812fx.service();
}
More complex effects can be created by dividing your string of LEDs into segments (up to ten) and programming each segment independently. Use the setSegment() function to program each segment's mode, color, speed and direction (normal or reverse):
Note, some effects make use of more than one color (up to three) and are programmed by specifying an array of colors:
// divide the string of LEDs into two independent segments
uint32_t colors[] = {RED, GREEN};
ws2812fx.setSegment(0, 0, (LED_COUNT/2)-1, FX_MODE_BLINK, colors, 1000, false);
ws2812fx.setSegment(1, LED_COUNT/2, LED_COUNT-1, FX_MODE_BLINK, COLORS(ORANGE, PURPLE), 1000, false);
5,050 followers · starred Oct 2018
118 followers · starred Dec 2016
80 followers · starred Sep 2020
189 followers · starred Mar 2022

This library features a variety of blinken effects for the WS2811/WS2812/NeoPixel LEDs. It is meant to be a drop-in replacement for the Adafruit NeoPixel library with additional features.
You can search for WS2812FX in the Arduino IDE Library Manager or install the latest (or development) version manually:
See examples for basic usage.
In it's most simple form, here's the code to get you started!
#include <WS2812FX.h>
#define LED_COUNT 30
#define LED_PIN 12
WS2812FX ws2812fx = WS2812FX(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
void setup() {
ws2812fx.init();
ws2812fx.setBrightness(100);
ws2812fx.setSpeed(200);
ws2812fx.setMode(FX_MODE_RAINBOW_CYCLE);
ws2812fx.start();
}
void loop() {
ws2812fx.service();
}
More complex effects can be created by dividing your string of LEDs into segments (up to ten) and programming each segment independently. Use the setSegment() function to program each segment's mode, color, speed and direction (normal or reverse):
Note, some effects make use of more than one color (up to three) and are programmed by specifying an array of colors:
// divide the string of LEDs into two independent segments
uint32_t colors[] = {RED, GREEN};
ws2812fx.setSegment(0, 0, (LED_COUNT/2)-1, FX_MODE_BLINK, colors, 1000, false);
ws2812fx.setSegment(1, LED_COUNT/2, LED_COUNT-1, FX_MODE_BLINK, COLORS(ORANGE, PURPLE), 1000, false);
5,050 followers · starred Oct 2018
118 followers · starred Dec 2016
80 followers · starred Sep 2020
189 followers · starred Mar 2022