If Y is >= a certain integer (10), then I want the code to go to next case statement. Problem is, that the integer is inside a while statement. Even though Y can and will go past 10, it just stays in the while loop inside of right away dropping and moving on to next case. Why?..how to get around this?
p.s. elapsedMillis timeElapsed is a special library to start millis back at 0 every time you call it.
case S_normalTwo: {
elapsedMillis timeElapsed;
elapsedSnap = timeElapsed;
Serial.println("S_normalTwo");
while ((timeElapsed) < (elapsedSnap + 5000)) {
int y;
thisFunction(y);
Serial.println (timeElapsed);
if (y >= 10) {
Serial.println("we made it here at least!");
updateTimeTwo = timeElapsed;
state = S_reverseTwo;
}
if ((timeElapsed) >= (elapsedSnap + 5000)) {
state = S_waitForSwitchPinHigh;
}
}
if ((timeElapsed) >= (elapsedSnap + 5000)) {
state = S_waitForSwitchPinHigh;
}