#include <LiquidCrystal_I2C.h>
#include<DHT.h>
DHT dht(2 , DHT22) ;
LiquidCrystal_I2C lcd(0x27 , 20 , 4 ) ;
int light ;
void setup() {
lcd.init() ;
dht.begin() ;
/*lcd.backlight() ;
lcd.noBacklight() ; */
Serial.begin(9600);
}
void loop() {
float s5ana = dht.readTemperature() ;
float humidity = dht.readHumidity() ;
light = 1023 - analogRead(A0);
light = light * 0.097 ;
lcd.setCursor(0 , 0) ;
lcd.print("temperature is "+String(s5ana)) ;
lcd.setCursor(0 ,1) ;
lcd.print("Humidity is "+String(humidity));
lcd.setCursor(0 ,2) ;
lcd.print("Light is "+String(light)+"%") ;
if(light < 20){
lcd.backlight() ;
}
else{
lcd.noBacklight() ;
}
}