Dear Hive Minds,
I have the following YAML effect that works great. Its turns on the LED strip to a given percentage. However I would prefer the strip to illuminate from the middle rather than beginning. Does anybody have an idea on how to accomplish this?
effects:
- addressable_lambda:
name: "75%"
lambda: |-
const int leds_to_use=140; // you can change that if you don't want all the leds to be used
// number of leds that are drawn with full brightness
float water_percentage = 75;
int full_leds = int(leds_to_use*water_percentage/100.0);
// set those leds to the current_color of the light
it.range(0, full_leds) = current_color;
// if full_leds is not the last led, render a remaining fraction of a led dimmed
if (full_leds < leds_to_use) {
it[full_leds] = current_color*((leds_to_use*water_percentage/100.0-full_leds)*255);
}
// set the remaing leds to black
if (full_leds+1 < leds_to_use) {
it.range(full_leds+1, leds_to_use) = ESPColor::BLACK; // change the color to something else if you want
}