We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]
Rating:
Author: MIKROE
Last Updated: 2018-07-11
Package Version: 1.0.0.0
mikroSDK Library: 1.0.0.0
Category: Temperature & humidity
Downloaded: 4724 times
Not followed.
License: MIT license
Temp-Hum 2 click is a smart temperature and humidity sensor click board, packed with features, that allow easy and simple integration into any design that requires accurate and reliable humidity and temperature measurements.
Do you want to subscribe in order to receive notifications regarding "Temp-Hum 2 click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "Temp-Hum 2 click" changes.
Do you want to report abuse regarding "Temp-Hum 2 click".
Library Description
The library initializes and defines the I2C bus driver and drivers that offer a choice for writing data in the register. The library includes the function for reads query device, electronic ID, firmware revision, temperature and humidity data. The user can select the measurement mode and set the Heater.
Key functions :
void temphum2_setMode(uint8_t selectMode, uint8_t speedMode)
- Functions for set measurement mode
void temphum2_getMeasurement( float *dataBuffer )
- Functions for measurement
void temphum2_writeByte(uint8_t reg, uint8_t _data)
- Functions for write one byte in register
Example description
The application is composed of three sections:
void applicationTask()
{
temphum2_getMeasurement( &dataBuffer[0] );
mikrobus_logWrite( " --- Temperature : ", _LOG_TEXT);
FloatToStr( dataBuffer[0] , dataText);
mikrobus_logWrite(dataText, _LOG_TEXT);
mikrobus_logWrite( " C", _LOG_LINE);
mikrobus_logWrite( " --- Humidity : ", _LOG_TEXT);
FloatToStr( dataBuffer[1] , dataText);
mikrobus_logWrite(dataText, _LOG_TEXT);
mikrobus_logWrite( " %RH", _LOG_LINE);
Delay_ms( 500 );
}
mikroE Libraries used in the example:
Additional notes and information
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. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.