simple RGB led library
Dependents: m3Dpi MQTT-Thermostat-example Final_project_Tran Final_project_Tran ... more
RGB-fun
RGB library used to control RGB leds using PWM modulation to dim and mix the individual colors. The library uses a Color helper class to define the colors. It is possible to define colors in these ways:
- web color notation:
#FF00AA
- Integer notation:
0 - 255
- Floating point notation:
0.0 - 1.0
By combining red, green and blue a great amount of colors can be created. This class can accept color objects or colors in hexadecimal notation (web color notation).
Note
Effects and effectsmanager are still experimental and not documented.
RGB class reference
Import library
Public Member Functions |
|
RGB (PinName r_pin, PinName g_pin, PinName b_pin) | |
Create a new
RGB
instance.
|
|
void | setColor ( Color *color) |
Set the color by giving an instance of an
Color
object.
|
|
void | setColor (int color) |
Set the color by giving an integer in hexadecimal notation.
|
|
Color * | getColor () |
Get the current color of the
RGB
led.
|
|
void | off () |
Turn the led off.
|
Color class reference
Import library
Public Types |
|
enum | Colors |
Enum with named colors for easy use. More... |
|
Public Member Functions |
|
Color (int red, int green, int blue) | |
Create
Color
instance, giving individual red, green and blue factors as integer values.
|
|
Color (float red, float green, float blue) | |
Create
Color
instance, giving individual red, green and blue factors as floating point values.
|
|
Color (int hexColor) | |
Create
Color
instance, giving red, green and blue factors as a single integer value.
|
|
int | getHex () |
Get the color value as an integer in hexadecimal notation.
|
|
int | getRed () |
Get the red factor of the color.
|
|
int | getGreen () |
Get the green factor of the color.
|
|
int | getBlue () |
Get the blue factor of the color.
|
Example
Repository: rgb-fun-helloworld
History
remove .orig files
2015-12-03, by sillevl [Thu, 03 Dec 2015 07:56:55 +0000] rev 7
remove .orig files
merged and added example
2015-11-19, by sillevl [Thu, 19 Nov 2015 08:16:58 +0000] rev 6
merged and added example
added documentation
2015-11-19, by sillevl [Thu, 19 Nov 2015 08:06:05 +0000] rev 5
added documentation
code cleanup
2015-10-22, by sillevl [Thu, 22 Oct 2015 17:17:13 +0000] rev 4
code cleanup
RGB fun!
2015-10-21, by sillevl [Wed, 21 Oct 2015 17:12:10 +0000] rev 3
RGB fun!
added effects class
2015-10-08, by sillevl [Thu, 08 Oct 2015 21:43:02 +0000] rev 2
added effects class
refactored inverter for pwm
2015-09-28, by sillevl [Mon, 28 Sep 2015 19:40:59 +0000] rev 1
refactored inverter for pwm
simple rgb driver
2015-09-28, by sillevl [Mon, 28 Sep 2015 19:36:49 +0000] rev 0
simple rgb driver