#include <DHT.h>

int SoilSensor = A0;
int LEDBiru = 12;
int LEDMerah = 11;
int LightSensor = 10;
int LEDPutih = 9;
int LEDHijau = 7;
DHT dht(8, DHT22);
float humidity;
float temperature;

void setup() {
  Serial.begin(9600);
  pinMode(SoilSensor, INPUT);
  pinMode(LEDBiru, OUTPUT);
  pinMode(LEDMerah, OUTPUT);
  pinMode(LightSensor, INPUT);
  pinMode(LEDPutih, OUTPUT);
  pinMode(LEDHijau, OUTPUT);
  dht.begin();

}

void loop() {
  int nilKelembapan = analogRead(A0);
  if (nilKelembapan < 700) {
    digitalWrite(LEDBiru, HIGH);
    digitalWrite(LEDMerah, LOW);
  }
  else {
    digitalWrite(LEDBiru, LOW);
    digitalWrite(LEDMerah, HIGH);
  }

  if (digitalRead(LightSensor) == HIGH){
    digitalWrite(LEDPutih, HIGH);
  }
  else{
  digitalWrite(LEDPutih, LOW);
  }

  humidity = dht.readHumidity();  temperature = dht.readTemperature();
   if(humidity >= 30.00 && humidity <= 40.00 && temperature >= 28.00){
    digitalWrite(LEDHijau, HIGH);
}
  else {
    digitalWrite(LEDHijau, LOW);
  }
}