 }
 
 void loop() {
- // Temperature & humidity detecting, monitoring
- int WaterSensorValue = analogRead(watersensor);
+ // Soil humidity detecting
+  nem= analogRead(soilsensor);
+  nem= map(nem,0,1023,0,100);
+
+  // Enviroment temperature & humidity detecting, monitoring
   float h = dht.readHumidity(); // Read humidity (%) - Nem oranı
   float t = dht.readTemperature(); // Read temperature as Celsius - Celsius cinsinden sıcaklık değeri
   float hic = dht.computeHeatIndex(t, h, false); // Compute heat index in Celsius - Isı indeksi (Hissedilen sıcaklık)

#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);

// Distance sensor (HC-SR04) Pins
#define trigPin 3
#define echoPin 2

// LEDs
int led1 = 7; // LED1(Mavi) 7. pine bağlı
int led2 = 12; // LED2(Sarı) 12. pine bağlı
int led3 = 11;  // LED3(Kırmızı) 11. pine bağlı

// Water level sensor
int watersensor = 0; // Water sensor integer, Arduino A0


void setup() {

     delay(250);
     digitalWrite(led3,LOW);
    }
    else if (nem  >= 20 && nem  < 50)
    {
     Serial.println("Toprak nem seviyesi / Soil humidity level: HIGH");
     digitalWrite(led2,HIGH);
     delay(500);
     digitalWrite(led2,LOW);
    }
    else if (nem  >= 50 && nem  < 75)
    {
     Serial.println("Toprak nem seviyesi / Soil humidity level: NORMAL");
     digitalWrite(led1,LOW);
     digitalWrite(led2,LOW);
     digitalWrite(led3,LOW);
    }
    else if (nem  >= 75 && nem  < 100)
    {
     digitalWrite(led1,HIGH);
     Serial.println("Toprak nem seviyesi / Soil humidity level: LOW");
     Serial.println("Sulama yapiliyor... / Watering...");
     for (pos = 0; pos <= 90; pos += 5) {
       // in steps of 5 degrees

