#include <LiquidCrystal_I2C.h> //Add LCD I2C library
#include <DHT.h>; //Add 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 6 //connected pin number
#define DHTTYPE DHT22 //DHT 22
DHT dht(DHTPIN, DHTTYPE); //start DHT sensor
void setup() {
LCD1.init(); //initialize 1st LCD
LCD1.backlight(); //turn on 1st backlight
LCD2.init(); //initialize 2nd LCD
LCD2.backlight(); //turn on 2nd backlight
dht.begin();
Serial.begin(9600);
pinMode(6, INPUT);
}
void loop() {
delay(2000);
float hum = dht.readHumidity(); //Read data and store variable hum
float temp = dht.readTemperature(); //Read data and store variable temp
LCD1.setCursor(0,0); //set cursor first line and first column
LCD1.print("Humidity ");
LCD1.setCursor(0,1);LCD1.print(hum); //print the humidity
LCD2.setCursor(0,0); //set cursor first line and first column
LCD2.print("Temperature ");
LCD2.setCursor(0,1);LCD2.print(temp); //print the temperature
delay(200);
}