Our main class. More...
#include <RGBlink.h>
Public Member Functions | |
LED (uint8_t to_red_pin, uint8_t to_green_pin, uint8_t to_blue_pin) | |
Initialize the LED-class. More... | |
LED (uint8_t to_red_pin, uint8_t to_green_pin, uint8_t to_blue_pin, bool to_inverted) | |
Initialize the LED-class with an invert-option. More... | |
void | on () |
Turn the LED on. More... | |
void | off () |
Turn the LED on. More... | |
void | update () |
Update cycle for non-blocking LED functions. More... | |
void | initDefaults () |
Reset the LEDs settings to the default values. | |
void | writeRGB (RGB to_color) |
Write an RGB value to the PWM-pins w/out changing the color buffer. | |
void | writeHSB (HSB to_color) |
Write an HSB value to the PWM-pins w/out changing the color buffer. More... | |
void | setColor (HSB to_color) |
Write a HSB color to the buffer. More... | |
void | setBlink (uint16_t to_on_val, uint16_t to_off_val) |
Set the blink parameters. More... | |
void | setMode (uint8_t to_mode) |
Set the LEDs mode. More... | |
int | getMode () |
Returns the LEDs current mode (0..4). | |
void | flash (uint16_t to_on_val) |
Flash the LED. More... | |
Our main class.
This class provides the functions used to drive a RGB-LED.
LED::LED | ( | uint8_t | to_red_pin, |
uint8_t | to_green_pin, | ||
uint8_t | to_blue_pin | ||
) |
Initialize the LED-class.
This class provides the functions used to drive a RGB-LED
to_red_pin | The Arduino pin the LEDs red pin is connected to |
to_green_pin | The Arduino pin the LEDs green pin is connected to |
to_blue_pin | The Arduino pin the LEDs blue pin is connected to |
LED::LED | ( | uint8_t | to_red_pin, |
uint8_t | to_green_pin, | ||
uint8_t | to_blue_pin, | ||
bool | to_inverted | ||
) |
Initialize the LED-class with an invert-option.
This class provides the functions used to drive a RGB-LED with inverted PWM
to_red_pin | The Arduino pin the LEDs red pin is connected to |
to_green_pin | The Arduino pin the LEDs green pin is connected to |
to_blue_pin | The Arduino pin the LEDs blue pin is connected to |
to_inverted | If 0 (false) this is much like the other LED-init, if 1 (true) all output PWM-values are inverted (255-x) |
void LED::flash | ( | uint16_t | to_on_val | ) |
void LED::off | ( | ) |
Turn the LED on.
Sets all PWM-pins to 0 (255 is the invert-option is set).
void LED::setBlink | ( | uint16_t | to_on_val, |
uint16_t | to_off_val | ||
) |
void LED::setColor | ( | HSB | to_color | ) |
void LED::setMode | ( | uint8_t | to_mode | ) |
void LED::update | ( | ) |
Update cycle for non-blocking LED functions.
Must be called every few milliseconds if you want to use functions like blink, fade or flash
void LED::writeHSB | ( | HSB | to_color | ) |
Write an HSB value to the PWM-pins w/out changing the color buffer.
like writeRGB(HSBtoRGB(RGB to_color)).