TOP Contributors

  1. MIKROE (2656 codes)
  2. Alcides Ramos (353 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 (136869 times)
  2. FAT32 Library (70000 times)
  3. Network Ethernet Library (55998 times)
  4. USB Device Library (46300 times)
  5. Network WiFi Library (41906 times)
  6. FT800 Library (41206 times)
  7. GSM click (29012 times)
  8. PID Library (26423 times)
  9. mikroSDK (26394 times)
  10. microSD click (25385 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-04-03

Package Version: 2.1.0.5

mikroSDK Library: 2.0.0.0

Category: LED Drivers

Downloaded: 42 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

Buck 14 click

0

The Buck 14 Click is a Click board™ based around the BMR4613001/001, a PoL regulator from Flex. It's high-efficiency step-down converter which provides a highly regulated output voltage derived from the connected power source, rated from 4.5 to 14V.

[Learn More]

Watchdog click

5

Watchdog Click is a compact add-on board that contains a simple countdown timer for a wide variety of applications. This board features the TPS3430, a standalone watchdog timer with a programmable watchdog window and programmable reset delay from Texas Instruments.

[Learn More]

HW Monitor 2 click

0

HW Monitor 2 Click is a compact add-on board used to monitor and regulate the performance of various hardware components within an embedded system. This board features the AMC80, an I2C-configurable system hardware monitor from Texas Instruments that contains a 10-bit ADC capable of measuring seven positive voltages and local temperature. The AMC80 also has two programmable fan speed monitoring inputs besides other hardware monitoring functions like chassis intrusion detection, additional external interrupt input, and master reset for external purposes, as well as a programmable upper over-limit and lower under-limit alarms that activate when the programmed limits are exceeded.

[Learn More]