Stopping loops via web commands.
Posted: Wed Dec 21, 2016 4:34 am
I'm using the esp8266 as a lighting controller. I ran into a problem and I'm not sure how to solve it.
Here's what I'm confused about. Esp8266 running an embedded webserver and the neopixel library. Everythign works just fine.
In the main loop I check for a connection like so:
So I can send a command like http://esp_ip_address/something/something and parse that. Ok easy enough. Works great for turning on and off the lights.
Wrote a "breath" function so the lights will slowly dim and brighten. But once I send that command to start that function i'm stuck in that loop and cannot send another web command to turn it off.
Is there any way around this other than setting a timer? So I could call the function and say "breath" for 5 minutes then stop? My guess is no but I thought I'd check .
Here's what I'm confused about. Esp8266 running an embedded webserver and the neopixel library. Everythign works just fine.
In the main loop I check for a connection like so:
Code: Select all
Serial.println("new client");
while(!client.available()){
delay(1);
}
So I can send a command like http://esp_ip_address/something/something and parse that. Ok easy enough. Works great for turning on and off the lights.
Wrote a "breath" function so the lights will slowly dim and brighten. But once I send that command to start that function i'm stuck in that loop and cannot send another web command to turn it off.
Is there any way around this other than setting a timer? So I could call the function and say "breath" for 5 minutes then stop? My guess is no but I thought I'd check .