Devices & Components
Arduino Uno Rev3
YL-69 Soil Hygrometer Humidity & Soil Moisture Detection Sensor For Arduino
Software & Tools
Arduino IDE
Project description
Code
Program of YL69 Soil Sensor with Arduino UNO R3
arduino
1int rainPin = A0; 2 3// you can adjust the threshold value 4int thresholdValue = 1000; 5 6void setup(){ 7 pinMode(rainPin, INPUT); 8 Serial.begin(9600); // Streaming 9600 bits of Sensor Data per Second 9} 10 11void loop() { 12 // read the input on analog pin 0: 13 int sensorValue = analogRead(rainPin); 14 Serial.println("Soil-humidity sensor value: "); 15 Serial.print(sensorValue); 16 if(sensorValue < thresholdValue){ 17 Serial.println(" - Plant doesn't need watering now..."); 18 19 } 20 else { 21 Serial.println(" - Time to water your plant now..."); 22 23 } 24 delay(3000); 25}
Program of YL69 Soil Sensor with Arduino UNO R3
arduino
1int rainPin = A0; 2 3// you can adjust the threshold value 4int 5 thresholdValue = 1000; 6 7void setup(){ 8 pinMode(rainPin, INPUT); 9 Serial.begin(9600); 10 // Streaming 9600 bits of Sensor Data per Second 11} 12 13void loop() { 14 // 15 read the input on analog pin 0: 16 int sensorValue = analogRead(rainPin); 17 18 Serial.println("Soil-humidity sensor value: "); 19 Serial.print(sensorValue); 20 21 if(sensorValue < thresholdValue){ 22 Serial.println(" - Plant doesn't need 23 watering now..."); 24 25 } 26 else { 27 Serial.println(" - Time to 28 water your plant now..."); 29 30 } 31 delay(3000); 32}
Downloadable files
Circuit Diagram of YL-69 Sensor with Arduino UNO R3
Circuit Diagram of YL-69 Sensor with Arduino UNO R3
Comments
Only logged in users can leave comments