I am trying to get a true/false value to switch each time I enter a specific loop. The code below isn't working right, I am not sure if the "!" operator can even be used for this purpose
void setup() {
boolean TickTock = false; // switches between "time remaining" and "temperature" display in the "maintain heat" mode
}
void loop() {
if (millis() - Time5 > DisplaySwitchTime) {
TickTock = !TickTock; // switch the display
Time5 = millis(); //
}
}
The code snippet you posted will not even compile. Did you leave some part of your sketch out?
boolean TickTock = false; // switches between "time remaining" and "temperature" display in the "maintain heat" mode
If you left out the declaration of the global variable TickTock, this local variable declaration/initialization is useless, since this variable goes out of scope immediately.
If you didn't, then TickTock is not even in scope when you try to toggle it. Seeing all the other variables, especially types, is important. The if() statement in the function may never evaluate to true if some types are wrong.