Forum Software Ferduino code Only 1 sensor osmosi

Only 1 sensor osmosi


Post Number:#1 Post Sun Dec 11, 2016 5:50 am
Posts: 101
Topics: 22
Solve rating: 0
Joined: Wed Sep 10, 2014 7:07 pm
Topics: 22
Age: 49
Gender: None specified
National Flag:
Italy
I would make topping up system of evaporated water with the use of only one float in sump
on temporary protection after 10 seconds if the sensor has not arrived to the off position you must stop the pump and trigger an alarm at the same time if the sesore returns off the first of 10 seconds must always stop the pump but without alarm

I did so but I do not work the time of 10 seconds

const byte sensorerabbocco = 49;
const byte pinrabbocco = 47;
boolean allarme_rabbocco = false;
unsigned long temporabbocco = 0;


tab setup
pinMode(sensorerabbocco, INPUT_PULLUP);
pinMode(pinrabbocco, OUTPUT);


tab loop

if (digitalRead (sensorerabbocco) == LOW)

{
   if (allarme_rabbocco == false)
    {
      digitalWrite(pinrabbocco, HIGH);
     

            if (millis() - temporabbocco > 10000)
   
        {
          digitalWrite(pinrabbocco, LOW);
          allarme_rabbocco = true;
          temporabbocco = millis();
        }
           
    }
}
else
 {
  digitalWrite(pinrabbocco, LOW);
  temporabbocco = millis();
 }





Post Number:#2 Post Sun Dec 11, 2016 12:25 pm
Posts: 1699
Topics: 38
Images: 301
Solve rating: 233
Joined: Mon Mar 03, 2014 5:59 pm
Topics: 38
Age: 40
Location: São Paulo
Gender: Male
National Flag:
Brazil

Hi!

Try this:

if (digitalRead(sensorerabbocco) == LOW)
{
  if (allarme_rabbocco == false)
  {
    if (digitalRead(pinrabbocco) == LOW)
    {
      temporabbocco = millis();
    }
    digitalWrite(pinrabbocco, HIGH);
  }
}
else
{
  digitalWrite(pinrabbocco, LOW);
  allarme_rabbocco = false;
}

if (((millis() - temporabbocco) > 10000) && (digitalRead(pinrabbocco) == HIGH))
{
  digitalWrite(pinrabbocco, LOW);
  allarme_rabbocco = true;
}


Best regards.
Post your doubts on forum because it can help another user too. Just PM me for support if it's absolutely necessary.




Return to Ferduino code





Who is online

Users viewing this topic: No registered users and 1 guest

cron