#include <DHT.h>
DHT dht(4, DHT22);
#define pinLEDGREEN 13;
#define pinLEDRED 12;
#define pinLEDBLUE 11;
void setup() {
Serial.begin(9600);
dht.begin();
pinMode(13, OUTPUT);
pinMode(12, OUTPUT);
pinMode(11, OUTPUT);
digitalWrite(13, LOW);
digitalWrite(12, LOW);
digitalWrite(11, LOW);
}
void loop() {
float kel = dht.readHumidity();
float suh = dht.readTemperature();
Serial.print("kelembaban: ");
Serial.print(kel);
Serial.print(" ");
Serial.print("suhu: ");
Serial.println(suh);
delay(1000);
if(suh>=40){
digitalWrite(12, HIGH);
delay(200);
digitalWrite(13, LOW);
digitalWrite(11, LOW);
}
else if (suh>=25 && suh<40){
digitalWrite(13, HIGH);
delay(200);
digitalWrite(12, LOW);
digitalWrite(11, LOW);
}
else if (suh<25){
digitalWrite(11, HIGH);
delay(200);
digitalWrite(13, LOW);
digitalWrite(12, LOW);
}
}