rgbring  2.1.0.0
Main Page

RGB Ring click

RGB Ring Click is a compact add-on board designed for dynamic and colorful lighting applications. This board features eight RGB LEDs (WL-ICLED 1312020030000) from Würth Elektronik, incorporating integrated circuits to control color mixing precisely. This board supports individual control of each LED's red, green, and blue components with single-wire communication enabling daisy-chaining. It also features the innovative Click Snap function, allowing the main LED area to be detached for flexible use, and includes a button for interactive functionality.

click Product page


Click library

  • Author : Stefan Filipovic
  • Date : Aug 2024.
  • Type : GPIO type

Software Support

We provide a library for the RGB Ring Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.

Package can be downloaded/installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Library Description

This library contains API for RGB Ring Click driver.

Standard key functions :

Example key functions :

Example Description

This example demonstrates the use of RGB Ring click board by controling an RGB ring

by cycling through a set of predefined colors. Each color is displayed by lighting up the LEDs in sequence around the ring. After the last LED is lit, the code waits for a button press before moving on to the next color in the sequence. The button press triggers the transition to the next color in the array.

The demo application is composed of two sections :

Application Init

Initializes the driver and performs the click default configuration which sets the color to black (all LEDs off).

void application_init ( void )
{
log_cfg_t log_cfg;
rgbring_cfg_t rgbring_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
rgbring_cfg_setup( &rgbring_cfg );
RGBRING_MAP_MIKROBUS( rgbring_cfg, MIKROBUS_1 );
if ( DIGITAL_OUT_UNSUPPORTED_PIN ==
rgbring_init( &rgbring, &rgbring_logic_zero, &rgbring_logic_one, &rgbring_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( RGBRING_ERROR == rgbring_default_cfg ( &rgbring ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}

Application Task

Controls an LED ring by cycling through colors and waits for user input to change

the ring's color. The button press is required to move to the next color in the sequence. The current color's name and RGB value are logged to the USB UART.

void application_task ( void )
{
static uint32_t color_num = 0;
static int8_t led_cnt = 0;
log_printf( &logger, " Color: %s [%.6LX]\r\n", color[ color_num ].name, color[ color_num ].rgb );
Delay_ms ( 100 );
for ( led_cnt = RGBRING_LED_7; led_cnt >= RGBRING_LED_0; led_cnt-- )
{
rgbring_set_led_color ( &rgbring, led_cnt, color[ color_num ].rgb );
Delay_ms ( 100 );
}
if ( ++color_num >= RGBRING_NUM_COLORS )
{
color_num = 0;
}
log_printf ( &logger, " Press button to change ring color\r\n\n" );
while ( RGBRING_BUTTON_RELESED == rgbring_get_int_pin ( &rgbring ) );
}

The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Other Mikroe Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.RGBRing

Additional notes and informations

Depending on the development board you are using, you may need USB UART click, USB UART 2 Click or RS232 Click to connect to your PC, for development systems with no UART to USB interface available on the board. UART terminal is available in all MikroElektronika compilers.


RGBRING_BUTTON_RELESED
#define RGBRING_BUTTON_RELESED
Definition: rgbring.h:110
rgbring_logic_t
void(* rgbring_logic_t)(void)
Function pointer for logic level one and zero.
Definition: rgbring.h:139
rgbring_cfg_t
RGB Ring Click configuration object.
Definition: rgbring.h:186
rgbring_set_led_color
void rgbring_set_led_color(rgbring_t *ctx, uint8_t led_num, uint32_t rgb)
RGB Ring set LED color function.
rgbring_init
err_t rgbring_init(rgbring_t *ctx, rgbring_logic_t logic_zero, rgbring_logic_t logic_one, rgbring_cfg_t *cfg)
RGB Ring initialization function.
application_task
void application_task(void)
Definition: main.c:108
rgbring_default_cfg
err_t rgbring_default_cfg(rgbring_t *ctx)
RGB Ring default configuration function.
rgbring_cfg_setup
void rgbring_cfg_setup(rgbring_cfg_t *cfg)
RGB Ring configuration object setup function.
RGBRING_LED_7
#define RGBRING_LED_7
Definition: rgbring.h:79
RGBRING_NUM_COLORS
#define RGBRING_NUM_COLORS
Definition: rgbring.h:102
RGBRING_ERROR
@ RGBRING_ERROR
Definition: rgbring.h:199
rgbring_write_led_matrix
err_t rgbring_write_led_matrix(rgbring_t *ctx)
RGB Ring write LED matrix function.
application_init
void application_init(void)
Definition: main.c:71
RGBRING_MAP_MIKROBUS
#define RGBRING_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition: rgbring.h:128
rgbring_get_int_pin
uint8_t rgbring_get_int_pin(rgbring_t *ctx)
RGB Ring get int pin function.
rgbring_t
RGB Ring Click context object.
Definition: rgbring.h:169
RGBRING_LED_0
#define RGBRING_LED_0
RGB Ring LED selection values.
Definition: rgbring.h:72