TOP Contributors

  1. MIKROE (2745 codes)
  2. Alcides Ramos (371 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (118 codes)
  5. Bugz Bensce (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 (138914 times)
  2. FAT32 Library (71500 times)
  3. Network Ethernet Library (56914 times)
  4. USB Device Library (47269 times)
  5. Network WiFi Library (42993 times)
  6. FT800 Library (42282 times)
  7. GSM click (29724 times)
  8. mikroSDK (27668 times)
  9. PID Library (26828 times)
  10. microSD click (26087 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

LED Driver 18 click

Rating:

0

Author: MIKROE

Last Updated: 2024-07-04

Package Version: 2.1.0.6

mikroSDK Library: 2.0.0.0

Category: LED Drivers

Downloaded: 81 times

Not followed.

License: MIT license  

LED Driver 18 Click is a compact add-on board that simplifies the control of multiple LEDs. This board features the TLC5947, a 24-channel LED driver from Texas Instruments. Each channel is individually adjustable with 4096 pulse-width modulated (PWM) steps and has a programmable current value of all channels with a maximum of 30mA of LED current per channel.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "LED Driver 18 click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "LED Driver 18 click" changes.

Do you want to report abuse regarding "LED Driver 18 click".

  • Information
  • Comments (0)

mikroSDK Library Blog


LED Driver 18 click

LED Driver 18 Click is a compact add-on board that simplifies the control of multiple LEDs. This board features the TLC5947, a 24-channel LED driver from Texas Instruments. Each channel is individually adjustable with 4096 pulse-width modulated (PWM) steps and has a programmable current value of all channels with a maximum of 30mA of LED current per channel.

leddriver18_click.png

click Product page


Click library

  • Author : Stefan Ilic
  • Date : Jan 2023.
  • Type : I2C type

Software Support

We provide a library for the LED Driver 18 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 LED Driver 18 Click driver.

Standard key functions :

  • leddriver18_cfg_setup Config Object Initialization function.

    void leddriver18_cfg_setup ( leddriver18_cfg_t *cfg );
  • leddriver18_init Initialization function.

    err_t leddriver18_init ( leddriver18_t *ctx, leddriver18_cfg_t *cfg );
  • leddriver18_default_cfg Click Default Configuration function.

    err_t leddriver18_default_cfg ( leddriver18_t *ctx );

Example key functions :

  • leddriver18_set_output_pwm LED Driver 18 set output channel PWM value function.

    err_t leddriver18_set_output_pwm ( uint8_t out_num, float pwm_val );
  • leddriver18_write_config LED Driver 18 write config function.

    void leddriver18_write_config ( leddriver18_t *ctx );
  • leddriver18_set_cc_output LED Driver 18 set constant current output function.

    err_t leddriver18_set_cc_output ( leddriver18_t *ctx, uint8_t current_limit );

Example Description

This library contains API for LED Driver 18 Click driver. The library initializes and defines the I2C bus drivers to write and read data for setting constant current output, as well as the default configuration for a PWM output value of the OUT pins.

The demo application is composed of two sections :

Application Init

Initializes the driver and performs default configuration and sets the device in output enabled mode.


void application_init ( void ) 
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    leddriver18_cfg_t leddriver18_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.
    leddriver18_cfg_setup( &leddriver18_cfg );
    LEDDRIVER18_MAP_MIKROBUS( leddriver18_cfg, MIKROBUS_1 );
    if ( I2C_MASTER_ERROR == leddriver18_init( &leddriver18, &leddriver18_cfg ) ) 
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }

    if ( LEDDRIVER18_ERROR == leddriver18_default_cfg ( &leddriver18 ) )
    {
        log_error( &logger, " Default configuration." );
        for ( ; ; );
    }

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

Application Task

This example demonstrates the use of the LED Driver 18 Click board by changing PWM values for all output from a minimum value to maximum value and back to minimum controlling the brightness of the LEDs in the process.

void application_task ( void ) 
{
    float pwm_val;

    for ( int8_t  n_cnt = 0; n_cnt <= 100; n_cnt += 10 )
    {
        for ( uint8_t out_cnt = 0; out_cnt < LEDDRIVER18_MAX_OUTPUT_NUM; out_cnt++ )
        {
            leddriver18_set_output_pwm( out_cnt, n_cnt );
        }
        pwm_val = leddriver18_get_output_pwm( 0 );
        log_printf( &logger, " PWM value: %.2f \r\n", pwm_val );
        leddriver18_write_config( &leddriver18 );
        Delay_ms ( 200 );
    }
    for ( int8_t  n_cnt = 100; n_cnt >= 10; n_cnt -= 10 )
    {
        for ( uint8_t out_cnt = 0; out_cnt < LEDDRIVER18_MAX_OUTPUT_NUM; out_cnt++ )
        {
            leddriver18_set_output_pwm( out_cnt, n_cnt );
        }
        pwm_val = leddriver18_get_output_pwm( 0 );
        log_printf( &logger, " PWM value: %.2f \r\n", pwm_val );
        leddriver18_write_config( &leddriver18 );
        Delay_ms ( 200 );
    }
}

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

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

RS232 click

5

Simple example which demonstrates working with RS232 click board in mikroBUS form factor. This code demonstrates how to use uart library routines. Upon receiving data via RS232, MCU immediately sends it back to the sender.

[Learn More]

GNSS RTK 3 DA click

0

GNSS RTK 3 Click is a compact add-on board that enhances the precision of position data derived from satellite-based positioning systems. This board features the LC29HDA, a dual-band, multi-castellation GNSS module from Quectel. This module supports the concurrent reception of all five global GNSS constellations: GPS, BDS, Galileo, GZSS, and GLONASS. It can receive and track many visible satellites in multi-bands, significantly mitigating the multipath effect in deep urban canyons and improving positioning accuracy.

[Learn More]

Accel 7 click

0

The acceleration sensing is based on the principle of measuring the differential capacitance, which further decreases errors due to manufacturing imperfections, temperature and other environmental influences. The micro-electromechanical sensor (MEMS) is coupled with a very advanced application specific integrated circuit (ASIC), which allows the simplicity of the KXTJ3-1057 design, requiring a low number of additional external components.

[Learn More]