Skip to content

Class daisy::RgbLed

ClassList > daisy > RgbLed

More...

  • #include <rgb_led.h>

Public Functions

Type Name
void Init (Pin red, Pin green, Pin blue, bool invert)
RgbLed ()
void Set (float r, float g, float b)
void SetBlue (float val)
void SetColor (Color c)
void SetGreen (float val)
void SetRed (float val)
void Update ()
~RgbLed ()

Detailed Description

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

Public Functions Documentation

function Init

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

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

Parameters:

  • red Red element
  • green Green element
  • blue Blue element
  • invert Flips led polarity

function RgbLed

inline daisy::RgbLed::RgbLed () 

function 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:

  • r Red element
  • g Green element
  • b Blue element

function SetBlue

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

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

Parameters:

  • val brightness of the blue channel

function SetColor

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

Sets the RGB using a Color object.

Parameters:


function SetGreen

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

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

Parameters:

  • val brightness of the green channel

function SetRed

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

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

Parameters:

  • val brightness of the red channel

function 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)


function ~RgbLed

inline daisy::RgbLed::~RgbLed () 


The documentation for this class was generated from the following file external-docs/libDaisy/src/hid/rgb_led.h