#include <DHT.h>
#include <LiquidCrystal_I2C.h>
#define DHTPIN 14
#define DHTTYPE DHT22
#define blower 15
#define led 18
DHT dht(DHTPIN, DHTTYPE);
LiquidCrystal_I2C LCD = LiquidCrystal_I2C(0x27, 16, 2);
void setup() {
pinMode(led,OUTPUT);
dht.begin();
LCD.init();
LCD.backlight();
pinMode(blower, OUTPUT);
}
void loop() {
float t,h;
char tmp[8];
t=dht.readTemperature();
h=dht.readHumidity();
if (isnan(t) || isnan(h))
{
Serial.print(F("eror reading"));
}
else
{
dtostrf(t,5,1,tmp);
LCD.setCursor(0,0);
LCD.print(tmp);
LCD.setCursor(5,0);
LCD.write(0xdf);
LCD.print("C");
dtostrf(h,6,1,tmp);
LCD.setCursor(0,1);
LCD.print(tmp);
LCD.setCursor(6,1);
LCD.print( "%");
}
digitalWrite(led, HIGH);
delay(2000); // this speeds up the simulation
}