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: 2021-07-30
Package Version: 1.0.0.1
mikroSDK Library: 1.0.0.0
Category: Temperature & humidity
Downloaded: 5884 times
Not followed.
License: MIT license
DHT22 2 click is used for measuring the environmental temperature and relative humidity. It uses the AM2322 sensor by ASAIR®, with very accurate thermal and humidity measuring capabilities. It can use either 1-Wire or I2C protocol to communicate with the integrated circuit.
Do you want to subscribe in order to receive notifications regarding "DHT22 2 click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "DHT22 2 click" changes.
Do you want to report abuse regarding "DHT22 2 click".
Library contains key functions used to read temperature and humidity data from the DHT22 2 click.
float DHT22_2_getTemperature();- Function for reading temperature from sensor
float DHT22_2_getHumidity()- Function for reading humidity from sensor
Examples Description
The example uses the library functions to read the temperature and humidity from the sensor and sends the data to the user, via the UART interface.
void applicationTask() { temp = DHT22_2_getTemperature(); humidity = DHT22_2_getHumidity(); FloatToStr(temp,output); UART1_Write_Text("Temperature: "); UART1_Write_Text(output); UART1_Write_Text("°C"); UART1_Write(13); UART1_Write(10); UART1_Write_Text("Humidity: "); FloatToStr(humidity,output); UART1_Write_Text(output); UART1_Write_Text("%"); UART1_Write(13); UART1_Write(10); Delay_ms(1000); }
Other 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 clickor 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.