#include <LiquidCrystal_I2C.h> //LCD I2C library:
#include <DHT.h>; //DHT22 sensor library:
LiquidCrystal_I2C lcd1(0x27, 16, 2); //LCD I2C address 0x27, 16 column and 2 rows!
LiquidCrystal_I2C lcd2(0x28, 16, 2); //LCD I2C address 0x28, 16 column and 2 rows!
#define DHTPIN 5 //what pin we're connected to
#define DHTTYPE DHT22 //DHT 22
DHT dht(DHTPIN, DHTTYPE); //Initialize DHT sensor for normal 16mhz Arduino
void setup() {
lcd1.init(); lcd1.backlight();
lcd2.init(); lcd2.backlight();
dht.begin();
Serial.begin(9600);
pinMode(5, INPUT);
}
void loop() {
delay(2000);
//Read data and store it to variables hum and temp
float hum = dht.readHumidity();
float temp = dht.readTemperature();
//Print temp and humidity values to serial monitor
Serial.print("Humidity: ");
Serial.print(hum);
Serial.println(" %; ");
Serial.print("Temperature: ");
Serial.print(temp);
Serial.println(" Celsius.\n");
lcd1.setCursor(0,0); //set cursor first line and first column
lcd1.print("HUM ");
lcd1.setCursor(5,0);lcd1.print(hum); //print the humidity on the LCD
lcd2.setCursor(0,0);lcd2.print("TEMP "); //set cursor first line and first column
lcd2.setCursor(6,0);lcd2.print(temp); //print the temperature on the LCD
delay(200);
}