humidity 2.2.0
Loading...
Searching...
No Matches
humidity


Humidity Click

Humidity 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 : Oct 2021.
  • Type : I2C type

Software Support

Example Description

This example demonstrates the use of Humidity Click board.

Example Libraries

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.Humidity

Example Key Functions

Application Init

Initializes the driver and logger. The I2C communication interface is selected by default.

void application_init ( void )
{
log_cfg_t log_cfg;
humidity_cfg_t humidity_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
humidity_cfg_setup( &humidity_cfg );
HUMIDITY_MAP_MIKROBUS( humidity_cfg, MIKROBUS_1 );
if ( HUMIDITY_OK != humidity_init( &humidity, &humidity_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
#define HUMIDITY_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition humidity.h:108
@ HUMIDITY_OK
Definition humidity.h:167
void application_init(void)
Definition main.c:30

Application Task

Reads the ADC voltage and then calculates the relative humidity from it. The calculated value of relative humidity in percents is being displayed on the USB UART approximately once per second.

void application_task ( void )
{
float voltage = 0;
if ( HUMIDITY_OK == humidity_read_voltage ( &humidity, &voltage ) )
{
log_printf( &logger, " Relative Humidity [%%RH]: %.2f\r\n\n", humidity_voltage_to_rh( &humidity, voltage ) );
}
Delay_ms ( 1000 );
}
void application_task(void)
Definition main.c:59

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.