// https://www.reddit.com/r/FastLED/comments/1am4bn5/trouble_wrapping_around_a_ring_with_crgbset/
#include <FastLED.h>
#define DATA_PIN PB1
#define NUM_LEDS 96
#define BRIGHTNESS 255
CRGB leds[NUM_LEDS];
const long outerInterval = 20;
int dot = 0;
int increment = 12;
void setup() {
FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS);
FastLED.setCorrection(TypicalPixelString);
FastLED.setBrightness(BRIGHTNESS);
}
void loop() {
EVERY_N_MILLIS(outerInterval) {
for (uint8_t ledpos = 0; ledpos < NUM_LEDS; ledpos++) {
CRGB col = CRGB::Black;
if ((ledpos + dot) % (increment * 2) < increment) {
leds[ledpos] = CRGB::Blue;
} else {
leds[ledpos] = CRGB::Black;
}
}
FastLED.show();
if (--dot < 0) dot = NUM_LEDS - 1;
}
}