#include <FastLED.h>
#include "FastLED_additions.h"
#define LED_PIN 3
#define NUM_LEDS 241
#define LED_TYPE WS2812
#define COLOR_ORDER GRB
CRGB leds[NUM_LEDS];
// how many LEDs in each ring
const uint8_t led_count[] = {60, 48, 40, 32, 24, 16, 12, 8, 1};
CRGBPalette16 currentPalette = RainbowHalfStripeColors_p;
void setup() {
FastLED.addLeds<LED_TYPE, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS);
}
void loop() {
static uint16_t startIndex = 0, phase = 0;
startIndex -= 320; /* rotation speed */
phase += 64; /* swirl speed */
CRGB *led = leds;
for (uint8_t ring = 0; ring < 9 ; ring++) {
uint16_t ringIndex = startIndex + sin16(phase + ring * 1024);
uint8_t count = led_count[ring];
for (uint8_t i = 0; i < count ; i++) {
uint16_t hue = ringIndex + i * 65535 / count;
*led++ = ColorFromPaletteExtended(currentPalette, hue, 255, LINEARBLEND);
}
}
FastLED.show();
}