FadeLed
A simple Arduino library to fade leds on hardware PWM
FadeLed.h File Reference

A simple Arduino library to fade LEDs on the hardware PWM. More...

#include "Arduino.h"
#include <avr/pgmspace.h>
#include "FadeLedGamma.h"

Go to the source code of this file.

Classes

class  FadeLed
 Main class of the FadeLed-library. More...
 

Macros

#define FADE_LED_PWM_BITS   8
 Sets the number of bits used for the PWM. More...
 
#define FADE_LED_MAX_LED   6
 Maximum number of FadeLed objects. More...
 
#define FADE_LED_RESOLUTION   ((1 <<FADE_LED_PWM_BITS) -1)
 The maximum brightness step of the PWM. More...
 

Typedefs

typedef uint8_t flvar_t
 Sets the variable type used for the brightness. More...
 

Detailed Description

A simple Arduino library to fade LEDs on the hardware PWM.

This library takes all the heavy lifting of fading a LED.

Macro Definition Documentation

◆ FADE_LED_MAX_LED

#define FADE_LED_MAX_LED   6

Maximum number of FadeLed objects.

Default = 6, the number of hardware PWM pins on an Uno/Pro Mini/Nano

◆ FADE_LED_PWM_BITS

#define FADE_LED_PWM_BITS   8

Sets the number of bits used for the PWM.

Set this to a higher value for devices with higher PWM resolution. Will set the upper limit and variable type correspondingly.

Default 8-bit: 0-255 for Uno/Nano/Pro Mini etc

Warning
Can't simply increase the number to have more PWM levels. It's limited to the hardware.

◆ FADE_LED_RESOLUTION

#define FADE_LED_RESOLUTION   ((1 <<FADE_LED_PWM_BITS) -1)

The maximum brightness step of the PWM.

Automatically set depending on FADE_LED_PWM_BITS. 255 for 8-bit.

Warning
Can't simply be increased for resolution! It depends on the resolution of the hardware used. Set it using FADE_LED_PWM_BITS.
See also
FADE_LED_PWM_BITS

Typedef Documentation

◆ flvar_t

typedef uint8_t flvar_t

Sets the variable type used for the brightness.

Is done automatically according to FADE_LED_PWM_BITS. A byte (uint8_t) is used for 8-bit or less. An unsigned int (uint16_t) is used for anything above. So limited to 16-bit PWM.

See also
FADE_LED_PWM_BITS