TOP Contributors

  1. MIKROE (2662 codes)
  2. Alcides Ramos (357 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 (137052 times)
  2. FAT32 Library (70178 times)
  3. Network Ethernet Library (56055 times)
  4. USB Device Library (46374 times)
  5. Network WiFi Library (41992 times)
  6. FT800 Library (41327 times)
  7. GSM click (29083 times)
  8. mikroSDK (26522 times)
  9. PID Library (26466 times)
  10. microSD click (25449 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

IR click

Rating:

0

Author: MIKROE

Last Updated: 2024-04-03

Package Version: 2.1.0.9

mikroSDK Library: 2.0.0.0

Category: Optical

Downloaded: 102 times

Not followed.

License: MIT license  

IR Click is an add-on board in mikroBUS form factor. It’s a compact and easy solution for adding infrared (IR) remote control module to your design.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "IR click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "IR click" changes.

Do you want to report abuse regarding "IR click".

  • mikroSDK Library 1.0.0.0
  • Comments (0)

mikroSDK Library Blog


IR click

IR Click is an add-on board in mikroBUS form factor. It’s a compact and easy solution for adding infrared (IR) remote control module to your design.

ir_click.png

click Product page


Click library

  • Author : Stefan Ilic
  • Date : Oct 2021.
  • Type : UART type

Software Support

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

Standard key functions :

  • ir_cfg_setup Config Object Initialization function.

    void ir_cfg_setup ( ir_cfg_t *cfg );
  • ir_init Initialization function.

    err_t ir_init ( ir_t *ctx, ir_cfg_t *cfg );

Example key functions :

  • ir_get_an_state IR get AN pin state function.

    uint8_t ir_get_an_state ( ir_t *ctx );
  • ir_nec_send_command IR NEC send data function.

    void ir_nec_send_command ( ir_t *ctx, uint8_t address, uint8_t command );
  • ir_nec_read_command IR NEC data reading function.

    err_t ir_nec_read_command ( ir_t *ctx, uint8_t *address, uint8_t *command );

Example Description

This is an example that demonstrates the use of the IR Click board.

The demo application is composed of two sections :

Application Init

Initialization driver enables - GPIO and Log.


void application_init ( void ) 
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    ir_cfg_t ir_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.
    ir_cfg_setup( &ir_cfg );
    IR_MAP_MIKROBUS( ir_cfg, MIKROBUS_1 );
    err_t error_flag = ir_init( &ir, &ir_cfg );
    if ( ( UART_ERROR == error_flag ) || ( PWM_ERROR == error_flag ) ) 
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }

    log_info( &logger, " Application Task " );
    log_printf( &logger, "- - - - - - - - - - - - \r\n" );

    #ifdef IR_TRANSMITTER_MODE
        log_printf( &logger, "-  Transmitter mode   - \r\n" );
    #else
        log_printf( &logger, "-    Receiver mode    - \r\n" );
    #endif
    log_printf( &logger, "- - - - - - - - - - - - \r\n" );
}

Application Task

This example contains two parts :

  • Transmitter mode - Sends data using NEC protocol.
  • Receiver mode - Reads data that is been sent using NEC protocol and displaying it on the UART terminal.

void application_task ( void ) 
{
    #ifdef IR_TRANSMITTER_MODE
        log_printf( &logger, " Sending message." );

        for ( uint8_t cnt = 0; cnt < 8; cnt++ )
        {
            ir_nec_send_command( &ir, 0x00, tx_data[ cnt ] );
            log_printf( &logger, "." );
            Delay_ms ( 50 );
        }

        log_printf( &logger, "\r\n Message sent! \r\n" );
        log_printf( &logger, "- - - - - - - - - - - - \r\n" );
        Delay_ms ( 500 );
    #else
        uint8_t arr;
        char rx_data;

        err_t err_flag = ir_nec_read_command ( &ir, &arr, &rx_data );

        if ( IR_OK == err_flag )
        {
            log_printf( &logger, "%c", rx_data );
        }
        else
        {
            log_printf( &logger, "Read ERROR! \r\n" );
        }
        Delay_ms ( 50 );
    #endif
}

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

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

IR Grid click

0

IR Grid click is a thermal imaging sensor. It has an array of 64 very sensitive factory calibrated IR elements (pixels), arranged in 4 rows of 16 pixels, each measuring an object temperature up to 300˚C within its local Field of View (FOV). The MLX90621ESF-BAD IR sensor used on this Click board™ has only four pins, and it is mounted inside of the industry standard TO39 package. It is equipped with 2Kbit of EEPROM for storing the compensation and calibration parameters.

[Learn More]

USB UART ISO click

0

USB UART ISO Click is a compact add-on board that offers a completely isolated differential pair of lines of the USB physical interface. This board features the ISOUSB111, a full/low-speed isolated USB repeater from Texas Instruments. It is a USB 2.0-compliant device that supports low-speed (1.5Mbps) and full-speed (12Mbps) signaling, USB On-The-Go (OtG), and Type-C Dual Role Port (DRP). In addition, this Click board™ comes with the FT232R, a USB UART IC from FTDI, making it a complete USB-to-UART isolated solution.

[Learn More]

Flash 8 click

0

Flash 8 Click is a compact add-on board representing a highly reliable memory solution. This board features the GD5F2GQ5UEYIGR, a 2Gb high-density non-volatile memory storage solution for embedded systems from GigaDevice Semiconductor. It is based on an industry-standard NAND Flash memory core, representing an attractive alternative to SPI-NOR and standard parallel NAND Flash with advanced features. The GD5F2GQ5UEYIGR also has advanced security features (8K-Byte OTP region), software/hardware write protection, can withstand many write cycles (minimum 100k), and has a data retention period greater than ten years.

[Learn More]