#include <DHT.h>
#include <LiquidCrystal_I2C.h>
#define I2C_ADDR 0x27// 27 hexadecimal
#define LCD_COLUMNS 20
#define LCD_LINES 4
//LiquidCrystal lcd(12, 11, 10, 9, 8, 7);
LiquidCrystal_I2C lcd(I2C_ADDR, LCD_COLUMNS, LCD_LINES);
// Pin DHT 11
#define DHT_PIN 6
#define DHT_TYPE DHT22
DHT dht(DHT_PIN, DHT_TYPE);
int value = 0 ; //Isi nilai sensor
int level = 0 ; //nilai level
void setup() {
// put your setup code here, to run once:
dht.begin();
lcd.init();
lcd.backlight();
Serial.begin(9600);
lcd.setCursor(6, 0);
lcd.print("BUDI SUTOMO");
lcd.setCursor(2, 1);
lcd.print("TEMPT. & HUMIDITY");
delay(4000);
lcd.clear();
}
void loop() {
// put your main code here, to run repeatedly:
delay(1000);
float temperature = dht.readTemperature();
float humidity = dht.readHumidity();
Serial.print("TEMPERATURE DETECTED: ");
Serial.print(temperature);
Serial.print(" HUMIDITY: ");
Serial.println(humidity);
lcd.setCursor(0, 0);
lcd.print("TEMPERATURE: ");
lcd.setCursor(13, 0);
lcd.print(temperature);
lcd.setCursor(0, 1);
lcd.print("HUMIDITY : ");
lcd.setCursor(13, 1);
lcd.print(humidity);
}