/* How to use the DHT-22 sensor with Arduino uno
Temperature and humidity sensor
*/
//Libraries
#include <DHT.h>;
#include <LiquidCrystal_I2C.h>
//Constants
#define DHTPIN 2 // what pin we're connected to
#define DHTTYPE DHT22 // DHT 22 (AM2302)
DHT dht(DHTPIN, DHTTYPE); //// Initialize DHT sensor for normal 16mhz Arduino
//Variables
int chk;
LiquidCrystal_I2C lcd (0x27,16,2);
int hum; //Stores humidity value
int temp; //Stores temperature value
void setup()
{
Serial.begin(9600);
lcd.init();
lcd.backlight();
lcd.setBacklight(HIGH);
}
void loop()
{
delay(2000);
//Read data and store it to variables hum and temp
hum = dht.readHumidity();
temp= dht.readTemperature();
//Print temp and humidity values to serial monitor
lcd.print("Vlaga: ");
lcd.print(hum);
lcd.print(" % ");
lcd.setCursor(0,1);
lcd.print ( "Temp: ");
lcd.print(temp);
lcd.println(" C");
delay(10000); //Delay 2 sec.
}