Barometer 11 Click
Barometer 11 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 : Mar 2025.
- Type : ADC/I2C type
Software Support
Example Description
This example demonstrates the use of the Barometer 11 Click board by initializing the device and reading the barometric pressure data in millibar units. The pressure value is periodically logged to the USB UART every second.
Example Libraries
- MikroSDK.Board
- MikroSDK.Log
- Click.Barometer11
Example Key Functions
- barometer11_cfg_setup This function initializes Click configuration structure to initial values.
void barometer11_cfg_setup(barometer11_cfg_t *cfg)
Barometer 11 configuration object setup function.
Barometer 11 Click configuration object.
Definition barometer11.h:163
- barometer11_init This function initializes all necessary pins and peripherals used for this Click board.
err_t barometer11_init(barometer11_t *ctx, barometer11_cfg_t *cfg)
Barometer 11 initialization function.
Barometer 11 Click context object.
Definition barometer11.h:148
- barometer11_read_voltage_avg This function reads a desired number of ADC samples and calculates the average voltage level.
err_t barometer11_read_voltage_avg(barometer11_t *ctx, uint16_t num_conv, float *voltage_avg)
Barometer 11 read average voltage level function.
- barometer11_read_pressure This function reads the pressure level [mBar].
err_t barometer11_read_pressure(barometer11_t *ctx, float *pressure)
Barometer 11 read pressure function.
Application Init
Initializes the logger and the Barometer 11 Click driver.
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
if ( ( ADC_ERROR == init_flag ) || ( I2C_MASTER_ERROR == init_flag ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
#define BAROMETER11_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition barometer11.h:124
void application_init(void)
Definition main.c:29
Application Task
Reads and displays the pressure data every second.
{
float pressure = 0;
{
log_printf( &logger, " Pressure : %.1f mBar\r\n\n", pressure );
Delay_ms ( 1000 );
}
}
@ BAROMETER11_OK
Definition barometer11.h:184
void application_task(void)
Definition main.c:60
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.