libDaisy
Hardware Library for Daisy
Loading...
Searching...
No Matches
daisy::RgbLed Class Reference

Detailed Description

3x LEDs configured as an RGB for ease of use.

#include <rgb_led.h>

Public Member Functions

 RgbLed ()
 
 ~RgbLed ()
 
void Init (dsy_gpio_pin red, dsy_gpio_pin green, dsy_gpio_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 ()
 

Constructor & Destructor Documentation

◆ RgbLed()

daisy::RgbLed::RgbLed ( )
inline

◆ ~RgbLed()

daisy::RgbLed::~RgbLed ( )
inline

Member Function Documentation

◆ Init()

void daisy::RgbLed::Init ( dsy_gpio_pin  red,
dsy_gpio_pin  green,
dsy_gpio_pin  blue,
bool  invert 
)

Initializes 3x GPIO Pins as red, green, and blue elements of an RGB LED

Parameters
redRed element
greenGreen element
blueBlue element
invertFlips led polarity

◆ Set()

void daisy::RgbLed::Set ( float  r,
float  g,
float  b 
)

Sets each element of the LED with a floating point number 0-1

Parameters
rRed element
gGreen element
bBlue element

◆ SetBlue()

void daisy::RgbLed::SetBlue ( float  val)

Sets the blue channel of the LED with a floating point number 0-1

Parameters
valbrightness of the blue channel

◆ SetColor()

void daisy::RgbLed::SetColor ( Color  c)

Sets the RGB using a Color object.

Parameters
cColor object to set.

◆ SetGreen()

void daisy::RgbLed::SetGreen ( float  val)

Sets the green channel of the LED with a floating point number 0-1

Parameters
valbrightness of the green channel

◆ SetRed()

void daisy::RgbLed::SetRed ( float  val)

Sets the red channel of the LED with a floating point number 0-1

Parameters
valbrightness of the red channel

◆ Update()

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)


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