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'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?
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.