FastLED 3.10.6
Loading...
Searching...
No Matches

◆ getAverageBrightness()

float getAverageBrightness ( fl::span< const CRGB > leds)

Definition at line 8 of file auto_brightness.cpp.

8 {
9 if (leds.empty()) {
10 return 0.0f;
11 }
12 uint32_t total = 0;
13 for (const CRGB &led : leds) {
14 total += led.r + led.g + led.b;
15 }
16 float avgValue = float(total) / float(leds.size() * 3);
17 return (avgValue / 255.0f) * 100.0f;
18}
CRGB leds[1]
fl::CRGB CRGB
Definition crgb.h:25
fl::u32 uint32_t
Definition stdint.h:218

References leds.