How to delay loop untill a condition satisfys

Hello geeks

I have a problem , i have done project its code posted down. In this i need to stop it at
if (humidityReal < 60)
{

digitalWrite(waterPump, HIGH);
delay(???)
}
and need loop to stop there till the condition becomes “false”

whole code is unnecessary since i need to stop loop till that condition fails i.,e humReal <60

and need loop to stop there till the condition becomes "false"

Until what condition becomes false?

whole code is unnecessary

Wrong. You really need to think in terms of "do something if the condition is true", rather than in terms of don't "do anything until the condition becomes false".

How does your code knows when a condition changes from true to false, without checking the state to change from true to false.

I think you need to change the way you are approaching the problem.

PaulS:
Until what condition becomes false?
Wrong. You really need to think in terms of “do something if the condition is true”, rather than in terms of don’t “do anything until the condition becomes false”.

The condition is humReal <60 it satisfied the loop executes, I can add delay(value) to stop the loop execution . But I need to stop the further execution till the condition fails

@sravankeddy: please stop reporting posts to the moderators, and answer the questions HERE.

Also:

To post code and/or error messages:

  1. Use CTRL-T in the Arduino IDE to autoformat your code.
  2. Paste the autoformatted code between code tags (the </> button)
    so that we can easily see and deal with your code.
  3. Paste the complete error message between code tags (the </> button)
    so that we can easily see and deal with your messages.

Before posting again, you should read the three locked topics at the top of the Programming Questions forum, and any links to which these posts point.

Good Luck!

The original code probably did not have emoticons in it.

@sravankreddy, please modify your post and use the code button </> so your code looks like this and is easy to copy to a text editor. See How to use the Forum

You should not be thinking of “How to delay loop”. You should make a special effort throughout your code to ensure that loop repeats as often as possible - hundreds or thousands of times per second.

You can cause a function not to act if a condition is not met. Look at the code in Planning and Implementing a Program. In that some of the functions do nothing if the time is not ripe. You can use the same technique with other conditional tests.

…R

sravankreddy:
The condition is humReal <60 it satisfied the loop executes, I can add delay(value) to stop the loop execution . But I need to stop the further execution till the condition fails

Use a while loop. In the loop read the humidity again as well as setting your pin, there is no need for any delay.

sravankreddy: Hello geeks

Look, buddy, you may not be aware, but "geeks" has some negative connations.

Geek

From that page:

... with a general pejorative meaning of a "peculiar person, especially one who is perceived to be overly intellectual, unfashionable, or socially awkward"

So you are asking for "socially awkward" people to help you? Maybe you are trying to be funny, but I suggest you drop the term.