lundi 27 avril 2020

how to power on the pump on arduino

I want to make a project that can start the pump according to the following conditions

the pump 1 will on if "jaraak" less than 5

the pump 2 will on if "jaraak" more than 10

the pump 3 and 4 wiil on if "tdsvalue" less than 700

the pump 2 will on if "tdsvalue" more than 800

Is the code that I made correct, because in my code just pump 1 always on

if (jaraak <= 5)
    { antares.getInt("jaraak");
      antares.add("Tandon Aman, jarak air " , jaraak  );
      digitalWrite(pompa1, pompaON);
      digitalWrite(pompa2, pompaOFF);
      }

  if (jaraak >= 10) 
    { antares.getInt("jaraak");
      antares.add("Tandon Habis, jarak air " , jaraak  );
      digitalWrite(pompa1, pompaOFF);
      digitalWrite(pompa2, pompaON);
      }

  if (tdsValue < 700)
    { antares.getFloat("tdsValue");
      antares.add("\n Kepekatan Nutrisi (ppm)" , tdsValue  );
      {digitalWrite(pompa3, pompaON);
      digitalWrite(pompa4, pompaON);}
    }

  if (tdsValue > 800)
    { antares.getFloat("tdsValue");
      antares.add("\n Kepekatan Nutrisi (ppm)" , tdsValue  );
      digitalWrite(pompa3, pompaOFF);
      digitalWrite(pompa4, pompaOFF);
      digitalWrite(pompa2, pompaON);
    }

Aucun commentaire:

Enregistrer un commentaire