Arduino RGB-Tools
Public Member Functions | List of all members
RGBTools Class Reference

Use this code with RGB-LEDs. More...

Public Member Functions

 RGBTools (uint8_t r, uint8_t g, uint8_t b)
 
 RGBTools (uint8_t r, uint8_t g, uint8_t b, Mode mode)
 
void setColor (uint8_t r, uint8_t g, uint8_t b)
 
void setColor (uint32_t)
 
void fadeTo (uint8_t r, uint8_t g, uint8_t b, int steps, int duration)
 

Detailed Description

Use this code with RGB-LEDs.

This class implements methods to control a RGB LED with Arduino

Constructor & Destructor Documentation

RGBTools::RGBTools ( uint8_t  r,
uint8_t  g,
uint8_t  b 
)

constructor; saves the pins

Parameters
[in]rThe Arduino pin number of the red pin of the LED
[in]gThe Arduino pin number of the green pin of the LED
[in]bThe Arduino pin number of the blue pin of the LED
RGBTools::RGBTools ( uint8_t  r,
uint8_t  g,
uint8_t  b,
Mode  mode 
)

Constructor using the Mode enum in header file. Ex: RGBTools(9, 10, 11, COMMON_ANODE);

Parameters
[in]rThe Arduino pin number of the red pin of the LED
[in]gThe Arduino pin number of the green pin of the LED
[in]bThe Arduino pin number of the blue pin of the LED
[in]modeThe mode of the RGB (common cathode / common anode)

Member Function Documentation

void RGBTools::fadeTo ( uint8_t  r,
uint8_t  g,
uint8_t  b,
int  steps,
int  duration 
)

Fades to custom color in specific time in specific steps

Parameters
[in]rThe red value ([0-255])
[in]gThe green value ([0-255])
[in]bThe blue value ([0-255])
[in]stepsThe number of steps to use
[in]durationThe duration of the fading in ms
void RGBTools::setColor ( uint8_t  r,
uint8_t  g,
uint8_t  b 
)

Set LED-color to custom color instantly

Parameters
[in]rThe red value ([0-255])
[in]gThe green value ([0-255])
[in]bThe blue value ([0-255])
void RGBTools::setColor ( uint32_t  color)

Set LED-color to custom color instantly Uses a 32 bit value to set a color.

Parameters
[in]colorThe 32 bit color value (eg. 0xFF0000 for red)

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