While executing code for following i am getting stack overflow. The part of code executes when scheduler controls triggers event.
VirtualPIN V5 is a slider control which decides how long the pump should run which is handled by timer.SetTimeout()
if i trigger this function manually the code works fine, like calling pump function on click on button.
But when same code is called from Scheduler trigger, the device gives stack-overflow and restarts itself
following is code line for Pump.
void pump()
{
Serial.println("Running Pump for ");
Blynk.syncVirtual(V5);
Serial.println(slider);
if(slider>0 && slider <= 15) //in case user sets slider > 20 then it should not exceed 20 minutes
{
led3.on();
Serial.println("switching pump ");
pumprunning=1;
digitalWrite(D7, HIGH);
hh = hour();
mm = minute();
dd = day();
mon = month();
timer.setTimeout(slider*60000, callMeLater);
}
else
{
led3.off();
Blynk.virtualWrite(V3, LOW);
}
}
can someone please help.
P.S: i tried with simple time input control the code works perfect with time input control but with scheduler it fails.
I had updated libraries and app as well.