Guest User

Untitled

a guest
May 17th, 2018
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. int sensorPin = A0; // select the input pin for the Soil moisture sensor
  2. int sensorValue = 0; // variable to store the value coming from the sensor
  3.  
  4. void setup() {
  5. // declare the ledPin as an OUTPUT:
  6. Serial.begin(9600);
  7. }
  8.  
  9. void loop() {
  10. // read the value from the sensor:
  11. sensorValue = analogRead(sensorPin);
  12. delay(1000);
  13. Serial.print("sensor = " );
  14. Serial.println(sensorValue);
  15.  
  16. if(sensorValue <= 300)
  17. {
  18. Serial.println("With out Water");
  19. }
  20. else
  21. {
  22. Serial.println("Water");
  23. }
  24. }
Add Comment
Please, Sign In to add comment