TOP Contributors

  1. MIKROE (2650 codes)
  2. Alcides Ramos (350 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 (136537 times)
  2. FAT32 Library (69731 times)
  3. Network Ethernet Library (55841 times)
  4. USB Device Library (46173 times)
  5. Network WiFi Library (41801 times)
  6. FT800 Library (40985 times)
  7. GSM click (28921 times)
  8. PID Library (26384 times)
  9. mikroSDK (26277 times)
  10. microSD click (25298 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: 40 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

Air Motion click

0

Air Motion Click is a compact add-on board that contains a 6-axis inertial measurement unit. This board features TDK InvenSense’s ICM-40627, a 6-axis MEMS MotionTracking™ device that combines a 3-axis user-selectable gyroscope accelerometer.

[Learn More]

3D Hall 7 click

0

3D Hall 7 click is a very accurate, magnetic field sensing Click board™, used to measure the intensity of the magnetic field across three perpendicular axes.

[Learn More]

Force 2 click

5

Force 2 Click is a mikroBUS add-on board with circuitry for implementing Honeywell’s FSS-SMT Series force sensors into your projects (with a single zone force sensing resistor included with the click).

[Learn More]