irthermo4  2.1.0.0
Main Page

IR Thermo 4 click

PRVIH_PAR_RECENICA_SA_PRODUCT_PAGE_DA_ISPRATE_CELINU

[click Product page](CLICK_PRODUCT_PAGE_LINK)


Click library

  • Author : Stefan Filipovic
  • Date : Jan 2024.
  • Type : I2C type

Software Support

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

Standard key functions :

Example key functions :

Example Description

This example demonstrates the use of IR Thermo 4 click board by reading and displaying the ambient and object temperature measurements.

The demo application is composed of two sections :

Application Init

Initializes the driver and performs the click default configuration.

void application_init ( void )
{
log_cfg_t log_cfg;
irthermo4_cfg_t irthermo4_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
irthermo4_cfg_setup( &irthermo4_cfg );
IRTHERMO4_MAP_MIKROBUS( irthermo4_cfg, MIKROBUS_1 );
if ( I2C_MASTER_ERROR == irthermo4_init( &irthermo4, &irthermo4_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( IRTHERMO4_ERROR == irthermo4_default_cfg ( &irthermo4 ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}

Application Task

Reads the ambient and object temperature measurements twice per second and displays the results on the USB UART.

void application_task ( void )
{
float ambient_temp = 0;
float object_temp = 0;
if ( IRTHERMO4_OK == irthermo4_read_ambient_temp ( &irthermo4, &ambient_temp ) )
{
log_printf ( &logger, " Ambient temperature: %.2f degC\r\n", ambient_temp );
if ( IRTHERMO4_OK == irthermo4_read_object_temp ( &irthermo4, &object_temp, ambient_temp ) )
{
log_printf ( &logger, " Object temperature: %.2f degC\r\n\n", object_temp );
}
}
Delay_ms ( 500 );
}

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

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.


irthermo4_read_object_temp
err_t irthermo4_read_object_temp(irthermo4_t *ctx, float *t_obj, float t_amb)
IR Thermo 4 read object temp function.
irthermo4_init
err_t irthermo4_init(irthermo4_t *ctx, irthermo4_cfg_t *cfg)
IR Thermo 4 initialization function.
irthermo4_cfg_t
IR Thermo 4 Click configuration object.
Definition: irthermo4.h:203
application_task
void application_task(void)
Definition: main.c:65
irthermo4_get_int_pin
uint8_t irthermo4_get_int_pin(irthermo4_t *ctx)
IR Thermo 4 get int pin function.
irthermo4_t
IR Thermo 4 Click context object.
Definition: irthermo4.h:184
irthermo4_read_ambient_temp
err_t irthermo4_read_ambient_temp(irthermo4_t *ctx, float *t_amb)
IR Thermo 4 read ambient temp function.
irthermo4_cfg_setup
void irthermo4_cfg_setup(irthermo4_cfg_t *cfg)
IR Thermo 4 configuration object setup function.
application_init
void application_init(void)
Definition: main.c:29
IRTHERMO4_ERROR
@ IRTHERMO4_ERROR
Definition: irthermo4.h:221
IRTHERMO4_MAP_MIKROBUS
#define IRTHERMO4_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition: irthermo4.h:153
irthermo4_default_cfg
err_t irthermo4_default_cfg(irthermo4_t *ctx)
IR Thermo 4 default configuration function.
IRTHERMO4_OK
@ IRTHERMO4_OK
Definition: irthermo4.h:220