Skip to content

daisy::RgbLed

Module: LIBDAISY / HUMAN_INTERFACE / FEEDBACK

More...

#include <rgb_led.h>

Public Functions

Name
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()

Detailed Description

class daisy::RgbLed;

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

Public Functions Documentation

function RgbLed

inline RgbLed()

function ~RgbLed

inline ~RgbLed()

function Init

void Init(
    dsy_gpio_pin red,
    dsy_gpio_pin green,
    dsy_gpio_pin blue,
    bool invert
)

Parameters:

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

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


function Set

void Set(
    float r,
    float g,
    float b
)

Parameters:

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

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


function SetRed

void SetRed(
    float val
)

Parameters:

  • val brightness of the red channel

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


function SetGreen

void SetGreen(
    float val
)

Parameters:

  • val brightness of the green channel

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


function SetBlue

void SetBlue(
    float val
)

Parameters:

  • val brightness of the blue channel

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


function SetColor

void SetColor(
    Color c
)

Parameters:

Sets the RGB using a Color object.


function Update

void Update()

Updates the PWM of the LED based on the current values. Should be called at a regular interval. (i.e. 1kHz/1ms)

---

Updated on 2024-01-03 at 19:41:01 +0000