#include <FastLED.h>
#if FASTLED_VERSION < 3001000
#error "Requires FastLED 3.1 or later; check github for latest code."
#endif
// Define FastLED parameters
#define NUM_LEDS 30
#define DATA_PIN 5
#define LED_TYPE WS2812B
#define COLOR_ORDER GRB
#define BRIGHTNESS 127
CRGB leds[NUM_LEDS]; // Set up the CRGB leds struct
#include "Animations.h" // Do quotes because local to this folder. If in the Arduino library folder, then do angled brackets
Animations animation;
// Setup
void setup() {
// Setup the Animations library, confirm good with serial display
animation.begin(19200);
// Setup LED strip
FastLED.delay(3000); // power-up safety delay for capacitor inrush
FastLED.addLeds<LED_TYPE,DATA_PIN,COLOR_ORDER>(leds,NUM_LEDS).setCorrection(TypicalLEDStrip);
FastLED.setBrightness(BRIGHTNESS);
FastLED.setDither(BRIGHTNESS < 255); // cpt-city palettes have different color balance
// Clear the strip and show Green
fill_solid(leds, NUM_LEDS, CRGB::Green);
FastLED.show();
FastLED.delay(1000);
FastLED.clear();
FastLED.show();
// Here is where I know the class method call does not work as intended...no strobe effect
// animation.strobe(leds, 0, 4, 255, 0, 0, 5, 200);
// FastLED.show();
}
// Loop
void loop() {
// What I an currently doing
// doStrobe(leds, 0, 4, 255, 0, 0, 5, 200);
// *** What I would like to achieve
animation.strobe_non_blocking(leds, 0, 4, 255, 0, 0, 5, 200);
FastLED.show();
}
void doStrobe(CRGB *ledArray, uint16_t locStart, uint16_t locEnd, uint8_t r, uint8_t g, uint8_t b, uint16_t flashNum, float flashDelay) {
Serial.println("Strobe from 'Loop'");
for (uint16_t i = 0; i < flashNum; i++) {
animation.basicSegmentFillSolid(ledArray, locStart, locEnd, r, g, b);
FastLED.show();
FastLED.delay(flashDelay);
animation.basicSegmentClear(ledArray, locStart, locEnd);
FastLED.show();
FastLED.delay(flashDelay);
}
}