RGBlink  1.0
an Arduino RGB-Led library
 All Classes Functions Variables
Public Member Functions | List of all members
LED Class Reference

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...
 

Detailed Description

Our main class.

This class provides the functions used to drive a RGB-LED.

Constructor & Destructor Documentation

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

Parameters
to_red_pinThe Arduino pin the LEDs red pin is connected to
to_green_pinThe Arduino pin the LEDs green pin is connected to
to_blue_pinThe 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

Parameters
to_red_pinThe Arduino pin the LEDs red pin is connected to
to_green_pinThe Arduino pin the LEDs green pin is connected to
to_blue_pinThe Arduino pin the LEDs blue pin is connected to
to_invertedIf 0 (false) this is much like the other LED-init, if 1 (true) all output PWM-values are inverted (255-x)

Member Function Documentation

void LED::flash ( uint16_t  to_on_val)

Flash the LED.

Sets the LED on and off again after n milliseconds (non-blocking).

Parameters
to_on_valis the time the LED should flash in milliseconds.
void LED::off ( )

Turn the LED on.

Sets all PWM-pins to 0 (255 is the invert-option is set).

void LED::on ( )

Turn the LED on.

Converts the current color to RGB and writes it to the pins.

void LED::setBlink ( uint16_t  to_on_val,
uint16_t  to_off_val 
)

Set the blink parameters.

Needed for mode 1 and 2 (blink / pulse)

Parameters
to_on_valis the time the LED should be on in milliseconds.
to_off_valis the time the LED should be off in milliseconds.
void LED::setColor ( HSB  to_color)

Write a HSB color to the buffer.

And if the LED is on to the PWM-pins.

void LED::setMode ( uint8_t  to_mode)

Set the LEDs mode.

0: single color 1: blink 2: pulse (soft blinking) 3: selftest (loops trough the HSB color spectrum in 3600 milliseconds) 4: flash (just needed for the flash() function)

Parameters
to_on_valis the time the LED should be on in milliseconds.
to_off_valis the time the LED should be off in milliseconds.
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)).


The documentation for this class was generated from the following files: