RGB-Led driver, used to handle convertions between HEX and integer to regulate LEDS through the embed.
RGB-Led program
What is this about?
This program is created for managing RGB-Led's through a HTTP protocol
Main.cpp include
This is a short demo how to use the RGB and Color classes
RGB Class
This is the RGB Class with all the documentation
Import library
Public Member Functions |
|
RGB (PinName r_pin , PinName g_pin , PinName b_pin ) | |
Create
RGB
instance.
|
|
void | setColor ( Color * color ) |
setColor instance This will set the color
|
|
void | setColor (int red, int green, int blue) |
setColor instance with
RGB
This will set the color with given values red, green, blue
|
|
void | setColor (int color ) |
setColor instance with integer color This will set the color with given integer
|
|
Color * | getColor () |
getColor instance This will return the current color in a Color* object
|
|
void | Off () |
Off instance This will turn off all the leds.
|
|
void | invertColor ( Color * color ) |
invertColor instance This will invert every color
|
|
Data Fields |
|
PinName | r_pin |
pinNames r_pin declaration Declaration of PinName r_pin
|
|
PinName | b_pin |
pinNames b_pin declaration Declaration of PinName b_pin
|
|
PinName | g_pin |
pinNames g_pin declaration Declaration of PinName g_pin
|
|
Color * | color |
color declaration of type Color* Declaration of Color* color
|
|
PwmOut * | r_out |
PwmOut r_out declaration Declaration of PwmOut r_out.
|
|
PwmOut * | b_out |
PwmOut b_out declaration Declaration of PwmOut b_out.
|
|
PwmOut * | g_out |
PwmOut g_out declaration Declaration of PwmOut g_out.
|
|
Static Public Attributes |
|
static const int | MAX_COLOR_VALUE = 255 |
static const int MAX_COLOR_VALUE Sets the maximum color value, 255 for
RGB
|
Color Class
This is the Color Class with all the documentation
Import library
Public Types |
|
enum | colors |
enum of colors More... |
|
Public Member Functions |
|
Color (int red, int green, int blue) | |
Color
instance with red, green, blue as integers.
|
|
Color (int color) | |
Color
instance with an integer.
|
|
Color (float red, float green, float blue) | |
Color
instance with red, green, blue as floats.
|
|
int | getHex () |
getHex method Returns the color as a Hex
|
|
int | getRed () |
getRed method Returns the color red as an integer
|
|
int | getGreen () |
getGreen method Returns the color green as an integer
|
|
int | getBlue () |
getBlue method Returns the color blue as an integer
|
color.h
- Committer:
- ciryk
- Date:
- 2015-12-10
- Revision:
- 9:dc800c7bf78e
- Parent:
- 7:c99e1708714f
File content as of revision 9:dc800c7bf78e:
#ifndef COLOR_H #define COLOR_H /** Color class * A Color class to manage the colors, from HEX to RGB or int. */ class Color { public: /** enum of colors */ enum colors { RED= 0xFF0000, GREEN = 0x00FF00, BLUE = 0x0000FF, CYAN = 0x00FFFF, MAGENTA = 0xFF00FF, YELLOW = 0xFFFFFF, WHITE = 0xFFFFFF, PINK = 0xFF69B4 }; /** Color instance with red, green, blue as integers */ Color(int red, int green, int blue); /** Color instance with an integer */ Color(int color); /** Color instance with red, green, blue as floats */ Color(float red, float green, float blue); /** getHex method *Returns the color as a Hex */ int getHex(); /** getRed method *Returns the color red as an integer */ int getRed(); /** getGreen method *Returns the color green as an integer */ int getGreen(); /** getBlue method *Returns the color blue as an integer */ int getBlue(); private: /** Declaration int red */ int red; /** Declaration int blue */ int blue; /** Declaration int green */ int green; /** Declaration int color */ int color; /** Declaration method floatToColorValue(float value) returns an int */ int floatToColorValue(float value); /**Sets the maximum color value, 255 for RGB */ static const int MAX_COLOR_VALUE = 255; }; #endif