#include<DHT.h>
#include<LiquidCrystal_I2C.h>
#define DHTPIN 4
#define DHTTYPE DHT22
#define LCD_COLUMNS 16
#define LCD_LINES 2
// add define ng LED sa activity 3
DHT dht(DHTPIN,DHTTYPE);
LiquidCrystal_I2C lcd (0x27, LCD_COLUMNS, LCD_LINES);
void setup() {
lcd.init();
lcd.backlight();
dht.begin();
// add ng pinMode sa activity 3
}
void loop() {
float temp = dht.readTemperature();
float hum = dht.readHumidity();
lcd.setCursor(0,0);
lcd.print("Temperature:");
lcd.print(temp);
lcd.print("C");
lcd.setCursor(0,1);
lcd.print("Humidity:");
lcd.print(hum);
lcd.print("%");
if (temp <= 27){
digitalWrite(GREEN, HIGH);
digitalWrite(BUZZER, HIGH);
digitalWrite(RED, LOW);
}
else {
digitalWrite(GREEN, LOW);
digitalWrite(BUZZER, LOW);
digitalWrite(RED, HIGH);
}
}