FastLED 3.9.3
Loading...
Searching...
No Matches
Apa102HD.ino File Reference

Detailed Description

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 <Arduino.h>
#include <FastLED.h>
#include <lib8tion.h>

Go to the source code of this file.

Macros

#define NUM_LEDS   20
 
#define STRIP_0_DATA_PIN   1
 
#define STRIP_0_CLOCK_PIN   2
 
#define STRIP_1_DATA_PIN   3
 
#define STRIP_1_CLOCK_PIN   4
 

Functions

CRGB software_gamma (const CRGB &in)
 
void setup ()
 
uint8_t wrap_8bit (int i)
 
void loop ()
 

Variables

CRGB leds_hd [NUM_LEDS] = {0}
 
CRGB leds [NUM_LEDS] = {0}
 

Macro Definition Documentation

◆ NUM_LEDS

#define NUM_LEDS   20

Definition at line 35 of file Apa102HD.ino.

◆ STRIP_0_CLOCK_PIN

#define STRIP_0_CLOCK_PIN   2

Definition at line 39 of file Apa102HD.ino.

◆ STRIP_0_DATA_PIN

#define STRIP_0_DATA_PIN   1

Definition at line 38 of file Apa102HD.ino.

◆ STRIP_1_CLOCK_PIN

#define STRIP_1_CLOCK_PIN   4

Definition at line 41 of file Apa102HD.ino.

◆ STRIP_1_DATA_PIN

#define STRIP_1_DATA_PIN   3

Definition at line 40 of file Apa102HD.ino.

Function Documentation

◆ loop()

void loop ( )

Definition at line 75 of file Apa102HD.ino.

◆ setup()

void setup ( )

Definition at line 59 of file Apa102HD.ino.

◆ software_gamma()

CRGB software_gamma ( const CRGB & in)

Definition at line 50 of file Apa102HD.ino.

◆ wrap_8bit()

uint8_t wrap_8bit ( int i)

Definition at line 66 of file Apa102HD.ino.

Variable Documentation

◆ leds

CRGB leds[NUM_LEDS] = {0}

Definition at line 45 of file Apa102HD.ino.

◆ leds_hd

CRGB leds_hd[NUM_LEDS] = {0}

Definition at line 44 of file Apa102HD.ino.