BLYNK
BLYNK.IO       πŸ“² GETTING STARTED       πŸ“— DOCS       πŸ‘‰ SKETCH BUILDER

How to change SimpleTimer timer interval remotely?

I’m struggeling to understand what you need help with?
You are posting different codes. You were on the right path with post #17, then you went bananaz and posted another piece of code which is entirely different :stuck_out_tongue:

Reason why your code in post #17 did not work is due to syntax errors from what I can see.

As I mentioned earlier, there was the double paranthesis but now I also notice you have a missing bracket.

#include <SimpleTimer.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
#include <Blynk.h>

int timerID =1;
int notifyUptime;
 
SimpleTimer timer;

BLYNK_WRITE(V0){   // add a slider on V0 range 0 to 30 (minutes)
  int seconds = param.asInt();
  Serial.println(seconds);
  timer.deleteTimer(timerID);
  timerID = timer.setInterval(seconds * 10000L, notifyUptime);
  Serial.print("V0 Slider value is: ");
  Serial.print("CountdownValue will be: ");
}  //<--- MISSING EARLIER

void setup()
{
   timerID = timer.setInterval(10000L, notifyUptime);  //<--- EXTRA PARANTHESIS EARLIER
}

void loop() 
{
  Blynk.run();
  timer.run();
}

Try it out. And next time do me a favour, before you post your code make sure you catch theese minor errors yourself, its not fun spending my time debugging at this level and I will refrain from helping unless I am extreeeeeeeeeeemly bored if I notice that errors are at this level. :stuck_out_tongue:

2 Likes

9 posts were split to a new topic: CanΒ΄t change the timer interval