/**************************************************
* *
* SUBMITTED BY: AQUINO, KEN HEART G. *
* SUBMITTED TO: PROF. MICHAEL T. SAMONTE *
* *************************************************/
#include <DHT.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#define DHTPIN 4
#define DHTTYPE DHT22
#define LED1 15
#define LED2 2
DHT dht(DHTPIN, DHTTYPE);
LiquidCrystal_I2C lcd(0x27, 20, 4);
void setup () {
lcd.init();
lcd.backlight();
dht.begin();
pinMode(LED1, OUTPUT);
pinMode(LED2, OUTPUT);
}
void loop() {
float temp = dht.readTemperature();
float hum = dht.readHumidity();
lcd.setCursor(0, 0);
lcd.print("Temp: ");
lcd.print(temp);
lcd.print(" C");
if (temp > 28.00)
{
digitalWrite(LED1, HIGH);
digitalWrite(LED2, LOW);
}
else
{
digitalWrite(LED1, LOW);
digitalWrite(LED2, HIGH);
}
lcd.setCursor(0, 1);
lcd.print("Humidity: ");
lcd.print(hum);
lcd.print(" %");
lcd.setCursor(0, 2);
lcd.print("Created By:");
lcd.setCursor(0, 3);
lcd.print("AQUINO, KEN HEART");
delay(2000);
}