A basic strip test program.
A basic strip test program.
This partially mirrors the behavior of the Adafruit NeoPixel "strandtest" example. Due to licensing issues that example cannot be included in this library, but I recommend trying to modify it yourself with the FastLED NeoPixel alterations.
#define DATA_PIN 6
#define NUM_LEDS 60
#define BRIGHTNESS 50
void setup() {
strip.begin();
strip.setBrightness(BRIGHTNESS);
}
void loop() {
colorWipe(strip.Color(255, 0, 0), 25);
colorWipe(strip.Color(0, 255, 0), 25);
colorWipe(strip.Color(0, 0, 255), 25);
colorWipe(strip.Color(255, 255, 255), 25);
theaterChase(strip.Color(0, 255, 255), 100, 3, 5);
theaterChase(strip.Color(255, 0, 255), 100, 3, 5);
theaterChase(strip.Color(255, 255, 0), 100, 3, 5);
rainbow(10, 3);
blank(1000);
}
void colorWipe(uint32_t color, unsigned long wait) {
for (unsigned int i = 0; i < strip.numPixels(); i++) {
strip.setPixelColor(i, color);
strip.show();
delay(wait);
}
}
void theaterChase(uint32_t color, unsigned long wait, unsigned int groupSize, unsigned int numChases) {
for (unsigned int chase = 0; chase < numChases; chase++) {
for (unsigned int pos = 0; pos < groupSize; pos++) {
strip.clear();
for (unsigned int i = pos; i < strip.numPixels(); i += groupSize) {
strip.setPixelColor(i, color);
}
strip.show();
delay(wait);
}
}
}
void rainbow(unsigned long wait, unsigned int numLoops) {
for (unsigned int count = 0; count < numLoops; count++) {
for (unsigned long firstPixelHue = 0; firstPixelHue < 65536; firstPixelHue += 256) {
for (unsigned int i = 0; i < strip.numPixels(); i++) {
unsigned long pixelHue = firstPixelHue + (i * 65536UL / strip.numPixels());
strip.setPixelColor(i, strip.gamma32(strip.ColorHSV(pixelHue)));
}
strip.show();
delay(wait);
}
}
}
void blank(unsigned long wait) {
strip.clear();
strip.show();
delay(wait);
}
Header for the FastLED_NeoPixel library.
FastLED implementation of the Adafruit_NeoPixel class for WS2812B strips, with data.
Definition FastLED_NeoPixel.h:413