/*
https://www.reddit.com/r/FastLED/comments/13wnqbr/smoothing_problem/
*/
#include <FastLED.h>
#define NUM_LEDS 36
CRGB leds[NUM_LEDS];
const CHSV hsv_colour = CHSV(25, 200, 200);
void setup() {
FastLED.addLeds<WS2812B, PB1, GRB>(leds, NUM_LEDS);
// Set the global brightness to the `value` of the HSV colour.
// The main loop will fade up to `value` 255, which helps FastLED's
// temporal dithering to increase the apparent bit depth.
FastLED.setBrightness(hsv_colour.v);
}
void loop() {
// smaller numbers give wider gradients
uint16_t gradientslope = 1800;
// how quickly the gradient moves along the strip, in 1/256ths of a pixel per frame
uint16_t gradientspeed = 50;
// position of gradient at power up
static int32_t gradientval = 0;
// if the fade in hasn't yet completed on the last LED
if (gradientval < 65536 + NUM_LEDS * gradientslope) {
// accumulate the gradient along the strip of LEDs
int32_t ledval = gradientval;
for (uint16_t ledno = 0; ledno < NUM_LEDS; ledno++) {
// clamp the brightness to the range 0-255
uint8_t brightness = 0;
if (ledval > 0) {
brightness = ledval < 65536 ? ledval / 256 : 255;
}
// set this LED to the chosen colour for this point on the gradient
leds[ledno] = CHSV(hsv_colour.h, hsv_colour.s, brightness);
// move to next position in the gradient
ledval -= gradientslope;
}
FastLED.show();
// move the gradient by some amount
gradientval += gradientspeed;
} else {
FastLED.delay(1000);
}
}
FPS: 0
Power: 0.00W
Power: 0.00W