0% found this document useful (0 votes)
35 views2 pages

Ex:-5 Implementation of Moisture Sensor For Your Application

The document describes implementing a moisture sensor in an application. It includes Arduino code to read the moisture sensor value, and output whether the soil is wet or dry by turning on different LEDs and printing to the serial monitor.

Uploaded by

Ruthra Devi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views2 pages

Ex:-5 Implementation of Moisture Sensor For Your Application

The document describes implementing a moisture sensor in an application. It includes Arduino code to read the moisture sensor value, and output whether the soil is wet or dry by turning on different LEDs and printing to the serial monitor.

Uploaded by

Ruthra Devi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Ex:-5 Implementation of Moisture

Sensor for your application


Created @September 2, 2021 10:21 PM

Tags

Ex:-5 Implementation of Moisture Sensor for your application 1


int value=0;
int soilPin=0;
int drySoil=7;
int wetSoil=13;
void setup()
{
Serial.begin(9600);
pinMode(drySoil,OUTPUT);
pinMode(wetSoil,OUTPUT);
pinMode(12, OUTPUT);
pinMode(11, OUTPUT);
}
void loop()
{
if(readSoil()>500)
{
Serial.println("WET SOIL");
digitalWrite(wetSoil,HIGH);
digitalWrite(drySoil,LOW);
digitalWrite(12,HIGH);
digitalWrite(11,LOW);
delay(1000);
}
else
{
digitalWrite(drySoil,HIGH);
digitalWrite(wetSoil,LOW);
digitalWrite(11,HIGH);
digitalWrite(12,LOW);
delay(1000);
Serial.println("DRY SOIL");
}
Serial.println("SOIL MOISTURE:");
Serial.println(readSoil());
delay(1000);
}
int readSoil()
{
value=analogRead(soilPin);
return value;
}

Ex:-5 Implementation of Moisture Sensor for your application 2

You might also like