TOP Contributors

  1. MIKROE (2660 codes)
  2. Alcides Ramos (356 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (112 codes)
  5. Chisanga Mumba (90 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 (137009 times)
  2. FAT32 Library (70133 times)
  3. Network Ethernet Library (56028 times)
  4. USB Device Library (46350 times)
  5. Network WiFi Library (41966 times)
  6. FT800 Library (41291 times)
  7. GSM click (29055 times)
  8. mikroSDK (26489 times)
  9. PID Library (26452 times)
  10. microSD click (25413 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

4x4 RGB 2 click

Rating:

0

Author: MIKROE

Last Updated: 2024-04-03

Package Version: 2.1.0.5

mikroSDK Library: 2.0.0.0

Category: LED matrix

Downloaded: 56 times

Not followed.

License: MIT license  

4x4 RGB 2 Click is a compact add-on board that contains a matrix of 16 intelligent RGB LEDs, forming a 4x4 display screen. This board features 16 IN-PC55TBTRGB, 5x5mm RGB LEDs with an integrated IC from Inolux. The LEDs feature an 8-bit color control in 256 steps (256-level greyscale) and a 5-bit brightness control in 32 steps. The intelligent LEDs are cascaded (daisy-chained); thus, every one of them can communicate with the host MCU using the same data lines.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "4x4 RGB 2 click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "4x4 RGB 2 click" changes.

Do you want to report abuse regarding "4x4 RGB 2 click".

  • Information
  • Comments (0)

mikroSDK Library Blog


4x4 RGB 2 click

4x4 RGB 2 Click is a compact add-on board that contains a matrix of 16 intelligent RGB LEDs, forming a 4x4 display screen. This board features 16 IN-PC55TBTRGB, 5x5mm RGB LEDs with an integrated IC from Inolux. The LEDs feature an 8-bit color control in 256 steps (256-level greyscale) and a 5-bit brightness control in 32 steps. The intelligent LEDs are cascaded (daisy-chained); thus, every one of them can communicate with the host MCU using the same data lines.

4x4rgb2_click.png

click Product page


Click library

  • Author : Stefan Filipovic
  • Date : Mar 2023.
  • Type : SPI type

Software Support

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

Standard key functions :

  • c4x4rgb2_cfg_setup Config Object Initialization function.

    void c4x4rgb2_cfg_setup ( c4x4rgb2_cfg_t *cfg );
  • c4x4rgb2_init Initialization function.

    err_t c4x4rgb2_init ( c4x4rgb2_t *ctx, c4x4rgb2_cfg_t *cfg );
  • c4x4rgb2_default_cfg Click Default Configuration function.

    err_t c4x4rgb2_default_cfg ( c4x4rgb2_t *ctx );

Example key functions :

  • c4x4rgb2_set_led_color This function sets the color of the selected led in the led matrix.

    void c4x4rgb2_set_led_color ( c4x4rgb2_t *ctx, uint8_t led_num, uint32_t rgb );
  • c4x4rgb2_set_led_brightness This function sets the brightness of the selected led in the led matrix.

    void c4x4rgb2_set_led_brightness ( c4x4rgb2_t *ctx, uint8_t led_num, uint8_t brightness );
  • c4x4rgb2_write_led_matrix This function writes the led matrix data from the click context object.

    err_t c4x4rgb2_write_led_matrix ( c4x4rgb2_t *ctx );

Example Description

This example demonstrates the use of 4x4 RGB 2 click board by setting all 16 LEDs to different colors and changing the LEDs color every 500 milliseconds.

The demo application is composed of two sections :

Application Init

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


void application_init ( void )
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    c4x4rgb2_cfg_t c4x4rgb2_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.
    c4x4rgb2_cfg_setup( &c4x4rgb2_cfg );
    C4X4RGB2_MAP_MIKROBUS( c4x4rgb2_cfg, MIKROBUS_1 );
    if ( SPI_MASTER_ERROR == c4x4rgb2_init( &c4x4rgb2, &c4x4rgb2_cfg ) )
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }

    if ( C4X4RGB2_ERROR == c4x4rgb2_default_cfg ( &c4x4rgb2 ) )
    {
        log_error( &logger, " Default configuration." );
        for ( ; ; );
    }

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

Application Task

Sets all 16 LEDs to a different colors and changes their color every 500 milliseconds. All data is displayed on the USB UART where you can track their changes.

void application_task ( void )
{
    static uint8_t color_num = 0;
    for ( uint8_t led_cnt = C4X4RGB2_LED_0; led_cnt <= C4X4RGB2_LED_15; led_cnt++ )
    {
        c4x4rgb2_set_led_color ( &c4x4rgb2, led_cnt, 
                                 color[ ( led_cnt + color_num ) % C4X4RGB2_NUM_COLORS ].rgb );
        log_printf( &logger, " LED %u Color: %s - %.6LX\r\n", ( uint16_t ) led_cnt, 
                    color[ ( led_cnt + color_num ) % C4X4RGB2_NUM_COLORS ].name, 
                    color[ ( led_cnt + color_num ) % C4X4RGB2_NUM_COLORS ].rgb );
    }
    if ( C4X4RGB2_OK == c4x4rgb2_write_led_matrix ( &c4x4rgb2 ) )
    {
        log_printf( &logger, " Write LED Matrix\r\n\n" );
        Delay_ms ( 500 );
    }
    if ( ++color_num >= C4X4RGB2_NUM_COLORS )
    {
        color_num = 0;
    }
}

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.4x4RGB2

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

Hall Current 9 click

0

Hall Current 9 Click is a compact add-on board that contains the coreless current sensor corresponding to the safety standards. This board features the CQ3300, a high-speed response coreless current sensor using a Hall sensor that outputs the analog voltage proportional to the AC/DC from AKM Semiconductor.

[Learn More]

OLED W click

5

OLED W click carries a 96 x 39px blue monochrome passive matrix OLED display. The display is bright, has a wide viewing angle and low power consumption. To drive the display, OLED B click features an SSD1306 controller.

[Learn More]

Wheatstone click

0

Wheatstone Click is a measurement Click board™ which utilizes a Wheatstone bridge circuit onboard, in order to precisely measure the resistance of an external element. Besides the wheatstone bridge circuit, this Click board™ also utilizes MAX4208 – an ultra-low offset/drift, precision instrumentation amplifier, from Maxim Integrated.

[Learn More]