#include <Wire.h>
#include<LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
int numRows = 4;
int numCols = 16;
#include <Adafruit_Sensor.h>
#include <DHT.h>
#define Type DHT22
#define relayPin3 3
int sensePin = 2;
DHT HT(sensePin, Type);
int humidity;
//float tempC
float tempF;
const int setTime = 50;
const int waitT = 5000;
void setup() {
Serial.begin(115200);
lcd.begin(numRows, numCols);
lcd.clear();
digitalWrite(relayPin3, OUTPUT);
pinMode(relayPin3, OUTPUT);
pinMode(13, OUTPUT);
pinMode(12, OUTPUT);
pinMode(11, OUTPUT);
HT.begin();
delay(setTime);
}
void loop() {
humidity = HT.readHumidity();
tempF = HT.readTemperature(true);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Room Temp is ");
lcd.print(tempF);
lcd.print("F");
lcd.setCursor(0, 1);
lcd.print("Humidity is ");
lcd.print(humidity);
lcd.print("% ");
lcd.setCursor(0, 3);
lcd.print("Red alarm at 70F");
lcd.setCursor(0, 2);
lcd.print("Yellow warning 65F");
if (tempF >= 80.01) digitalWrite(11, HIGH);
else digitalWrite(11, LOW);
if ((tempF >= 75.01) && (tempF <= 80.00)) digitalWrite(12, HIGH);
else digitalWrite(12, LOW);
if (tempF <= 75.00) digitalWrite(13, HIGH);
else digitalWrite(13, LOW);
if (tempF >= 75.01) digitalWrite(3, LOW);
else digitalWrite(3, HIGH);
delay(waitT);
}