FadeLed
A simple Arduino library to fade leds on hardware PWM
|
Show difference between constant fade speed and constant fade time. More...
#include <FadeLed.h>
Macros | |
#define | elements(x) sizeof(x)/sizeof(x[0]) |
Functions | |
void | setup () |
void | loop () |
Variables | |
FadeLed | leds [] = {5, 6} |
Show difference between constant fade speed and constant fade time.
Septillion (https://github.com/sseptillion)
This is an example to show the difference between constant fade speed (default) and constant fade time. Both LEDs will just fade up and down to halve brightness with the same time set. One with constant fade speed, one with constant fade time.
pin 5: Constant fade speed This LED will fade with constant fade speed. The time set is the time it takes between off and full brightness (or vice versa). So when fading by less then all the steps (255) it's finished in less time. For example, fading to halve brightness will also take have the time.
pin 6: Constant fade time This LED will fade with constant fade time. The time set is the time it takes for one fade, no matter the values from/to it fades. For example, a fade between off and full brightness will take the same time as a fade from off to 100. Useful for example if you want to fade a RGB LED from one color to another in a set time, no matter the levels of the individual colors.