#include <FastLED.h>
CRGBArray<110> leds;
void setup() {
FastLED.addLeds<WS2812B, PB1, GRB>(leds, leds.size());
}
uint32_t seed = 0x5eed517;
void loop() {
const auto fades = 128; // number of simultaneous fades
seed -= 0x2a08c07 * 2 * (fades - 1); // rewind PRNG by N-1 fades
uint16_t v16 = 0; // accumulator for Value/Brightness
for (auto i = 0; i < fades; i++) {
uint16_t rnd = hash16();
uint8_t h = rnd >> 8;
uint8_t s = rnd;
uint8_t v = v16 >> 8;
if (v < 128) v *= 2; // fade out
else v = 255 - 2 * v; // fade in
leds[hash16() % leds.size()] += CHSV(h, s, v);
v16 += 65536 / fades;
}
FastLED.show();
FastLED.clear();
}
// a simple 16-bit PRNG using a 32-bit seed
uint16_t hash16() {
seed += 0x2a08c07;
return (seed >> 16) ^ (uint16_t)seed;
}
FPS: 0
Power: 0.00W
Power: 0.00W