TOP Contributors

  1. MIKROE (2779 codes)
  2. Alcides Ramos (376 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (118 codes)
  5. Bugz Bensce (97 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (139560 times)
  2. FAT32 Library (72041 times)
  3. Network Ethernet Library (57254 times)
  4. USB Device Library (47607 times)
  5. Network WiFi Library (43219 times)
  6. FT800 Library (42551 times)
  7. GSM click (29930 times)
  8. mikroSDK (28292 times)
  9. PID Library (26930 times)
  10. microSD click (26309 times)
Libstock prefers package manager

Package Manager

We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]

< Back
mikroSDK Library

Rotary RGB Click

Rating:

0

Author: MIKROE

Last Updated: 2024-10-31

Package Version: 2.1.0.5

mikroSDK Library: 2.0.0.0

Category: Rotary encoder

Downloaded: 53 times

Not followed.

License: MIT license  

Rotary RGB Click is a compact add-on board for creating visual effects and precise position indications. This board features 16 individual RGB LEDs (WS2812B-2020) from Worldsemi and a high-quality rotary encoder (EC12D1564402) from ALPS. The WS2812B-2020 offers low driving voltage, high brightness, and excellent consistency, while the rotary encoder provides accurate 15-pulse incremental encoding with push-button functionality.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "Rotary RGB Click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "Rotary RGB Click" changes.

Do you want to report abuse regarding "Rotary RGB Click".

  • Information
  • Comments (0)

mikroSDK Library Blog


Rotary RGB Click

Rotary RGB Click is a compact add-on board for creating visual effects and precise position indications. This board features 16 individual RGB LEDs (WS2812B-2020) from Worldsemi and a high-quality rotary encoder (EC12D1564402) from ALPS. The WS2812B-2020 offers low driving voltage, high brightness, and excellent consistency, while the rotary encoder provides accurate 15-pulse incremental encoding with push-button functionality.

rotaryrgb_click.png

Click Product page


Click library

  • Author : Nenad Filipovic
  • Date : Jan 2024.
  • Type : GPIO type

Software Support

We provide a library for the Rotary RGB 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 Rotary RGB Click driver.

Standard key functions :

  • rotaryrgb_cfg_setup Config Object Initialization function.

    void rotaryrgb_cfg_setup ( rotaryrgb_cfg_t *cfg );
  • rotaryrgb_init Initialization function.

    err_t rotaryrgb_init ( rotaryrgb_t *ctx, rotaryrgb_cfg_t *cfg );

Example key functions :

  • rotaryrgb_set_led_pos_color This function sets the desired color for the selected LED position

    err_t rotaryrgb_set_led_pos_color ( rotaryrgb_t *ctx, uint8_t led_pos, uint32_t led_color );
  • rotaryrgb_set_all_leds_data This function, using the GPIO protocol, writes the desired array of 16 elements of data to control all LEDs.

    void rotaryrgb_set_all_leds_data ( rotaryrgb_t *ctx, uint32_t *data_in );
  • rotaryrgb_get_state_switch This function return rotary encoder switch signal, states of the SW(INT) pin.

    uint8_t rotaryrgb_get_state_switch ( rotaryrgb_t *ctx );

Example Description

This library contains the API for the Rotary RGB Click driver to control LEDs states and a rotary encoder position readings.

The demo application is composed of two sections :

Application Init

Initialization of GPIO module and log UART. After the driver init, the app turn off all LEDs.

void application_init ( void ) 
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    rotaryrgb_cfg_t rotaryrgb_cfg;  /**< Click config object. */

    /** 
     * Logger initialization.
     * Default baud rate: 115200
     * Default log level: LOG_LEVEL_DEBUG
     * @note If USB_UART_RX and USB_UART_TX 
     * are defined as HAL_PIN_NC, you will 
     * need to define them manually for log to work. 
     * See @b LOG_MAP_USB_UART macro definition for detailed explanation.
     */
    LOG_MAP_USB_UART( log_cfg );
    log_init( &logger, &log_cfg );
    log_info( &logger, " Application Init " );

    // Click initialization.
    rotaryrgb_cfg_setup( &rotaryrgb_cfg, &rotaryrgb_logic_zero, &rotaryrgb_logic_one );
    ROTARYRGB_MAP_MIKROBUS( rotaryrgb_cfg, MIKROBUS_1 );
    if ( DIGITAL_OUT_UNSUPPORTED_PIN == rotaryrgb_init( &rotaryrgb, &rotaryrgb_cfg ) ) 
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }

    rotaryrgb_set_all_led_color( &rotaryrgb, ROTARYRGB_COLOR_OFF );
    Delay_ms ( 100 );

    log_info( &logger, " Application Task " );
    Delay_ms ( 100 );
}

Application Task

This example demonstrates the use of the Rotary RGB Click board. The demo example shows the functionality of a rotary encoder used to control RGB LEDs. The switch controls the application of the colors, and the encoder mechanism controls the state of the LEDs.

void application_task ( void ) 
{
    rotaryrgb_set_led_pos_color( &rotaryrgb, led_pos % 17, demo_color_table[ led_color_sel ] );
    rotaryrgb_switch_detection( );
    rotaryrgb_encoder_mechanism( );
}

Note

Make sure the logic delays are defined for your system in the rotaryrgb_delays.h file.

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.RotaryRGB

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.


ALSO FROM THIS AUTHOR

Flash 6 Click

0

The Flash 6 Click based on W25Q128JV (128M-bit) flash memory from Winbond provides a storage solution for systems with limited space, pins and power.

[Learn More]

OBD II click

0

OBDII click offers a unique opportunity to tap inside the car diagnostic systems. It features the STN1110 Multiprotocol OBD to UART Interface, developed by the ScanTool technologies.

[Learn More]

GNSS RTK Click

0

GNSS RTK Click is a compact add-on board used to enhance the precision of position data derived from satellite-based positioning systems. This board features the ZED-F9P, a multi-band GNSS module with integrated multi-band Real Time Kinematics (RTK) technology offering centimeter-level accuracy from U-blox. This module concurrently uses GNSS signals from all four GNSS constellations (GPS, GLONASS, Galileo, and BeiDou), and provides multi-band RTK with fast convergence times, reliable performance, and easy integration. It also includes moving base support, allowing both base and rover to move while computing a centimeter-level accurate position between them.

[Learn More]