SHARE
TWEET

Water Conductor

ppuskari Apr 1st, 2016 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. // the setup function runs once when you press reset or power the board
  3. void setup() {
  4.   // initialize inputs and outputs
  5.   pinMode(4, INPUT); //humidity 1 if > 40%
  6.   pinMode(5, INPUT); //temp integer
  7.   pinMode(6, INPUT); //photo sensor 1 if >400 lumens
  8.   pinMode(7, INPUT); // water sensor 0 if water present 1 if dry
  9.   pinMode(8, OUTPUT);  //  pump on/off
  10. }
  11. int water;
  12. int humid;
  13. int photo;
  14. int temp;
  15. // the loop function runs over and over again forever
  16. void loop() {
  17.   water=digitalRead(7);
  18.   humid=digitalRead(4);
  19.   photo=digitalRead(6);
  20.   temp=digitalRead(5);
  21.  
  22.   if (photo<1) {
  23.     if (humid<1) {
  24.       if (temp>32){
  25.         if (water > 0)  { // turn the pump off
  26.           digitalWrite(8, LOW);
  27.         } else {
  28.           digitalWrite(8, HIGH); //turn pump on
  29.         }
  30.       }
  31.     }
  32.   }
  33.  
  34.   delay(100);              // wait for a second
  35.  
  36.  
  37. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top