// LCD1602 to Arduino Uno connection example
#include <DHT.h>;
#include <LiquidCrystal.h>
//Constants
#define DHTPIN 2 // DHT SDA pin connected to Pin 2
#define DHTTYPE DHT22 // DHT 22
DHT dht(DHTPIN, DHTTYPE); //// Initialize DHT sensor for normal 16mhz Arduino
LiquidCrystal lcd(12, 11, 10, 9, 8, 7);
//Variables
float hum; //Stores humidity value
float temp; //Stores temperature value
void setup()
{
lcd.begin(16, 2);
// you can now interact with the LCD, e.g.:
lcd.print("Weather station");
lcd.setCursor(0,0);
Serial.begin(9600);
dht.begin();
}
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.setCursor(0, 1);
lcd.print("Humi: ");
lcd.setCursor(5, 1);
lcd.print(hum);
lcd.setCursor(7, 1);
lcd.print("%,Temp: ");
lcd.setCursor(14, 1);
lcd.print(temp);
delay(10000); //Delay 2 sec.
}