delay a while statement?

Is it possible to delay within a while statement? Basically, can you still stay in the first (or second) while statement if the condition is false for 1 second and return to where it left off? or is it just going to run through the second while statement before going back to the first no matter what?

while (sVoltage > wVoltage) 
    {
    digitalWrite(13, HIGH);
    }
    
      while (sVoltage < wVoltage)
    {
      digitalWrite(13, LOW);
    }

A program will stay in a while loop while its controlling condition is true. If you want to introduce a delay once the condition becomes false then you can do it but it must be outside (after) the while loop so that the delay occurs before the program moves on to the next statement.

You need to take a look at blink without delay.

Mark

holmes4:
You need to take a look at blink without delay.

I was saving that for later as I am not sure that I actually understood the question in the first place

You're not reading sVoltage and wVoltage within the while loops, so your program will forever be stuck in one or the other of them. What's wrong with if statements?

Thanks for pointing that out henry, i will look further into that.

How can you read the 2 seperate voltages and then compare them?

V8_Kind_Of_Guy:
How can you read the 2 seperate voltages and then compare them?

As you've posted only a code snippet, I can't tell how you're reading them at the moment, but I suggest you read them into your variables, sVoltage and wVoltage within the while loop. The comparison is in the while() statement.