I have my code running in a loop for main but I want to add a while loop so I can "pause" the program when a switch is flipped on the cloud dashboard.
This works:
void loop() {
ArduinoCloud.update();
// Your code here
if (i < 10)
{
i++;
humidity = i;
}
if (i > 9)
{
i = 0 ;
humidity = i;
}
if (temp > 75)
{
temp = 0;
}
}
This does not work:
void loop() {
ArduinoCloud.update();
// Your code here
while (cycleRunning){
if (i < 10)
{
i++;
humidity = i;
}
if (i > 9)
{
i = 0 ;
humidity = i;
}
if (temp > 75)
{
temp = 0;
}
}
}
cycleRunning is a bool
The only change is the while loop. The only thing outside of main is the auto generated variables for accessing the cloud. I have already read this thread. Any Ideas?