Load Cell + RTC

Hello Fellas;
Hope you´re doing great.

So im doing a project wich uses a load cell and an rtc, and i´ve got into this problem:

void SERVO(){
if (units < pesoMinimo && exatashoras == true)
{
while (units >= pesoLimite){
digitalWrite (led432, HIGH);
units = scale.get_units(), 10;
}
}
else if (units >= pesoLimite){
digitalWrite (led432, LOW);
}
}
so my problem is thati have to do 2 comparations between units (wich is the weight onto the load cell) and between a value that is totally programable by the user (pesoMinimo). I still have that “exatashoras” wich is a condition that everytime the minutes in the rtc are pair, i recive 1.
What i wanted to happen here is if the units are < then the minimum value and the minutes are pair, then, until the units are >= than the maximum value (pesoLimite), the led432 wouldn´t stop “shinning”. It would only stop, if units get >= then the maximum value.
Rly hope you could help me.

Your question is not making a contribution to the old Thread where you have posted it so I have suggested to the Moderator to move it to its own Thread.

I think your problem is that your ELSE clause will trigger if either of the tests in the IF clause fails.

I’m not sure that I understand your description but I think you need to separate the time check from the weight check - maybe something like this. However your code snippet does not show how exatshoras is set so I may have got things all wrong. If you want more help please post the complete program.

And shouldn’t the WHILE be < rather than >=

if (exatashoras == true) {
   okToTestForWeight = true;
}


if (okToTestForWeight == true) {
   if (units < pesoMinimo)
  {
    while (units < pesoLimite){
      digitalWrite (led432, HIGH);
      units = scale.get_units(), 10;
  }
}
else if (units >= pesoLimite){ 
  digitalWrite (led432, LOW);  
}

…R

@J0hnyKidCarcassas, do not hijack. Thread split as requested.

Considering the age of the old Thread I would not consider it a hijack - more like taking a room in an abandoned hotel :)

...R