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
- irthermo4_cfg_setup Config Object Initialization function.
void irthermo4_cfg_setup(irthermo4_cfg_t *cfg)
IR Thermo 4 configuration object setup function.
IR Thermo 4 Click configuration object.
Definition irthermo4.h:207
- irthermo4_init Initialization function.
err_t irthermo4_init(irthermo4_t *ctx, irthermo4_cfg_t *cfg)
IR Thermo 4 initialization function.
IR Thermo 4 Click context object.
Definition irthermo4.h:188
- irthermo4_default_cfg Click Default Configuration function.
err_t irthermo4_default_cfg(irthermo4_t *ctx)
IR Thermo 4 default configuration function.
- irthermo4_read_ambient_temp This function reads and calculates the ambient temperature in degrees Celsius.
err_t irthermo4_read_ambient_temp(irthermo4_t *ctx, float *t_amb)
IR Thermo 4 read ambient temp function.
- irthermo4_read_object_temp This function reads and calculates the object temperature in degrees Celsius.
err_t irthermo4_read_object_temp(irthermo4_t *ctx, float *t_obj, float t_amb)
IR Thermo 4 read object temp function.
- irthermo4_get_int_pin This function returns the INT pin logic state.
uint8_t irthermo4_get_int_pin(irthermo4_t *ctx)
IR Thermo 4 get int pin function.
Application Init
Initializes the driver and performs the Click default configuration.
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
if ( I2C_MASTER_ERROR ==
irthermo4_init( &irthermo4, &irthermo4_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
{
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.
{
float ambient_temp = 0;
float object_temp = 0;
{
log_printf ( &logger, " Ambient temperature: %.2f degC\r\n", 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.