irthermo4 2.2.0
Loading...
Searching...
No Matches
irthermo4


IR Thermo 4 Click

IR Thermo 4 Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.


Click Library

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

Software Support

Example Description

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

Example Libraries

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.IRThermo4

Example Key Functions

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 " );
}
#define IRTHERMO4_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition irthermo4.h:157
@ IRTHERMO4_ERROR
Definition irthermo4.h:225
void application_init(void)
Definition main.c:29

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 );
}
@ IRTHERMO4_OK
Definition irthermo4.h:224
void application_task(void)
Definition main.c:65

Application Output

This Click board can be interfaced and monitored in two ways:

  • Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
  • UART Terminal - Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.

Additional Notes and Information

The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.