Need help with adding instructions to a code

#include <LiquidCrystal.h>
#include "DHT.h"

LiquidCrystal lcd(2, 3, 4, 5, 6,7);
const int relay_Pin = 8;
const int DHT11_Sesnor = 9;
const int moisture_sensor = A0;
const int rain_Sesnor = A1;

#define DHTTYPE DHT11
int moisture_sensor_value;
int rain_Sesnor_value;
float humudity_value,temprature_value;
DHT dht(DHT11_Sesnor, DHTTYPE);

void setup() {
Serial.begin(9600);
pinMode(relay_Pin, OUTPUT);
lcd.begin(16, 2);
lcd.print("Smart Irrigation ");
lcd.setCursor(0,2);
lcd.print(" SYSTEM");
digitalWrite(relay_Pin, LOW);
dht.begin();
delay(2000);
}
void loop()
{

readDTH11_Sesnor();
moisture_level_detected();
water_motor_start();
}

void readDTH11_Sesnor()
{

// Reading temperature or humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
humudity_value = dht.readHumidity();
// Read temperature as Celsius (the default)
temprature_value = dht.readTemperature();

// Check if any reads failed and exit early (to try again).
if (isnan(humudity_value) || isnan(temprature_value)) {
Serial.println(("Failed to read from DHT sensor!"));
return;
}

Serial.print((" Humidity: "));
Serial.print(humudity_value);
Serial.print(("%"));
lcd.clear();
lcd.print("Humidity %: ");
lcd.setCursor(0,2);
lcd.print(humudity_value);
Serial.print("\n");
delay(1000);
Serial.print(("Temperature: "));
Serial.print(temprature_value);
Serial.print(("C "));
lcd.clear();
lcd.print("Temperature degCel");
lcd.setCursor(0,2);
lcd.print(temprature_value);
Serial.print("\n");
delay(1000);
}

void moisture_level_detected()
{

moisture_sensor_value = analogRead(moisture_sensor);
Serial.println("Moisture Level : ");
Serial.println(moisture_sensor_value);
lcd.clear();
lcd.print("Moisture Level :");
lcd.setCursor(0,2);
lcd.print(moisture_sensor_value);
delay(2000);
}

void water_motor_start()
{

rain_Sesnor_value = analogRead(rain_Sesnor);
Serial.print("rain sensor value :: ");
Serial.println(rain_Sesnor_value);
delay(1000);
if(rain_Sesnor_value > 700)
{
if(moisture_sensor_value > 700 )
{
digitalWrite(relay_Pin, HIGH);
delay(2000);
}
else
{
digitalWrite(relay_Pin, LOW);
delay(2000);
}
}
else
{
digitalWrite(relay_Pin, LOW);
delay(2000);
}
}

how do i add this into the main code above......?

When soil moisture <= 800 the soil is considered to be WET soil else the soil is considered to be DRY soil.
When the temperature is <= 27 degrees C, it is considered LOW temperature else its HIGH temperature.
When the humidity is <= 40%, it’s considered Low Humidity else anything above that is considered HIGH.
When the soil moisture is > 800, the Temperature is <=27 degrees C, and the Humidity is Low/High the water pump should be turned ON to irrigate the crops

If the temperature is >27 degrees C, the soil is considered wet and the Humidity is high/Low the water pump remains turned OFF.

If the Temperature is >27 degrees C, the soil is considered dry and the Humidity is high/low the water pump remains OFF as the temperature is too high to irrigate crops.

If the soil moisture is < 800, Wet soil, no matter what the temperature and humidity are, the water pump remains OFF.

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use [color = red]code tags[/color] (the < CODE/ > icon above the compose window) to make it easier to read and copy for examination

https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum

As this question has nothing to do with the IDE itself it has been moved to the Programming category of the forum

What is yuour question?

In your code you don't have a name variable
"threshold".

Are you asking about making the relay ON and OFF?

Please edit your post to add code tags.

Do not modify your post in such a way that someone's help loses its meaning.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.