3x LEDs configured as an RGB for ease of use.
#include <rgb_led.h>
Public Member Functions | |
| RgbLed () | |
| ~RgbLed () | |
| void | Init (Pin red, Pin green, Pin blue, bool invert) |
| void | Set (float r, float g, float b) |
| void | SetRed (float val) |
| void | SetGreen (float val) |
| void | SetBlue (float val) |
| void | SetColor (Color c) |
| void | Update () |
|
inline |
|
inline |
Initializes 3x GPIO Pins as red, green, and blue elements of an RGB LED
| red | Red element |
| green | Green element |
| blue | Blue element |
| invert | Flips led polarity |
| void daisy::RgbLed::Set | ( | float | r, |
| float | g, | ||
| float | b ) |
Sets each element of the LED with a floating point number 0-1
| r | Red element |
| g | Green element |
| b | Blue element |
| void daisy::RgbLed::SetBlue | ( | float | val | ) |
Sets the blue channel of the LED with a floating point number 0-1
| val | brightness of the blue channel |
| void daisy::RgbLed::SetColor | ( | Color | c | ) |
| void daisy::RgbLed::SetGreen | ( | float | val | ) |
Sets the green channel of the LED with a floating point number 0-1
| val | brightness of the green channel |
| void daisy::RgbLed::SetRed | ( | float | val | ) |
Sets the red channel of the LED with a floating point number 0-1
| val | brightness of the red channel |
| void daisy::RgbLed::Update | ( | ) |
Updates the PWM of the LED based on the current values. Should be called at a regular interval. (i.e. 1kHz/1ms)