|
FastLED 3.9.15
|
Example showing how to use the APA102HD gamma correction.
Example showing how to use the APA102HD gamma correction with user override.
In this example we compare two strips of LEDs.
One strip is in HD mode, the other is in software gamma mode.
Each strip is a linear ramp of brightnesses, from 0 to 255.
Showcasing all the different brightnesses.
Why do we love gamma correction? Gamma correction more closely
matches how humans see light. Led values are measured in fractions
of max power output (1/255, 2/255, etc.), while humans see light
in a logarithmic way. Gamma correction converts to this eye friendly
curve. Gamma correction wants a LED with a high bit depth. The APA102
gives us the standard 3 components (red, green, blue) with 8 bits each, it
*also* has a 5 bit brightness component. This gives us a total of 13 bits,
which allows us to achieve a higher dynamic range. This means deeper fades.
Example:
CRGB leds[NUM_LEDS] = {0};
void setup() {
FastLED.addLeds<
APA102HD, // <--- This selects HD mode.
STRIP_0_DATA_PIN,
STRIP_0_CLOCK_PIN,
RGB
>(leds, NUM_LEDS);
}
Definition in file Apa102HD.ino.
Include dependency graph for Apa102HD.ino:Go to the source code of this file.
Macros | |
| #define | NUM_LEDS 20 |
| #define | STRIP_0_CLOCK_PIN 2 |
| #define | STRIP_0_DATA_PIN 1 |
| #define | STRIP_1_CLOCK_PIN 4 |
| #define | STRIP_1_DATA_PIN 3 |
Functions | |
| void | loop () |
| void | setup () |
| CRGB | software_gamma (const CRGB &in) |
| uint8_t | wrap_8bit (int i) |
Variables | |
| CRGB | leds [NUM_LEDS] = {0} |
| CRGB | leds_hd [NUM_LEDS] = {0} |