Blynk button state problem unable to shot off digital pin

Hello everybody
Dealing with some blynk related project. the code it self is basic and simple
(Blink with different timing integers applied) but in blynk they say to avoid delays.they recommend using simpleTimer library instead. The code it self runs as programmed but

the problem is that im unable to stop it by pressing the button
when i OFF the button it does shot it down , but after some seconds ( maybe 30) it starts running the loop again.
code attached where am i mistaking? using Wemos d1 r2

Thanks in advance!

#include <ESP8266WiFi.h> // for ESP8266
#include <BlynkSimpleEsp8266.h> // for ESP8266
#include <SimpleTimer.h>
#define BLYNK_MSG_LIMIT 0 

BlynkTimer timer;

char auth[] = "~~~~~~"; // Auth Token 
char pass[] = "~~~~~~"; // Your WiFi network password
char server[] = "blynk-cloud.com"; // Cloud Server address
int port = 8080; // MCU Hardware Device port int LEDArduino = D5;

void setup() {

pinMode(LEDArduino, OUTPUT);
// Set
up GPIO2 (D4 the ESP On-Board LED) as an
output pin
// Connect to your WiFi network, then to the Blynk Server WiFi.begin(ssid, pass);

Blynk.config(auth, server, port);

Blynk.connect();


timer.setInterval(30000L, []() { // Start 1st Timed Lambda Function - Turn ON LED every 30 seconds (repeating)

timer.setTimeout(200L, []() {(once per loop)

Blynk.virtualWrite(V0, 0); // Turn Virtual LED OFF

digitalWrite(LEDArduino , HIGH); // Turn ESP On-Board LED OFF }); 

Blynk.virtualWrite(V0, 255);

}); // END 1st Timer Function }

BLYNK_WRITE(V0) {
int pinValue = param.asInt();
Serial.print("Pin number: "); Serial.println(LEDArduino); Serial.println(pinValue);

if (pinValue == 1) {
digitalWrite(LEDArduino, HIGH); // Turn LED on. } else {
digitalWrite(LEDArduino, LOW); // Turn LED off. }
}


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

Thank you!

Please correct your post above and add code tags around your code:
[code]`` [color=blue]// your code is here[/color] ``[/code].

It should look like this:// your code is here
(Also press ctrl-T (PC) or cmd-T (Mac) in the IDE before copying to indent your code properly)

ensure each line is also well positioned, here you have code and closing brackets as part of comments

if we can't see you real code as it is compiled, we will loose time guessing what might be wrong...


Your 2nd lambda functions is within the first one, is that intended ?

you’ve posted 22 times and still haven’t learned to use code tags?

Arrow008:
Hello everybody
Dealing with some blynk related project. the code its self is basic and simple
(Blink with different timing integers) but in blynk they say to avoid delays and they recommend using
simpleTimer library instead.
The code it self runs as programmed but
the problem is that im unable to stop it by pressing the button
when i OFF the button it does shot it down , but after some seconds ( maybe 30) it starts running the loop again
this is the code i use where am i mistaking? using Wemos d1 r2

Thanks in advance!

#include <ESP8266WiFi.h> // for ESP8266

#include <BlynkSimpleEsp8266.h> // for ESP8266
#include <SimpleTimer.h>
#define BLYNK_MSG_LIMIT 0 // In theory this disables the “anti-flood governor”… might only work on Local Server

BlynkTimer timer;

char auth = “"; // Auth Token char ssid[] = “I’m AweSome”; // Your WiFi network name
char pass[] = "
”; // Your WiFi network password
char server = “blynk-cloud.com”; // Cloud Server address
int port = 8080; // MCU Hardware Device port int LEDArduino = D5;

void setup() {

pinMode(LEDArduino, OUTPUT);
// Set
up GPIO2 (D4 the ESP On-Board LED) as an
output pin
// Connect to your WiFi network, then to the Blynk Server WiFi.begin(ssid, pass);

Blynk.config(auth, server, port);

Blynk.connect();

timer.setInterval(30000L, { // Start 1st Timed Lambda Function - Turn ON LED every 30 seconds (repeating)

timer.setTimeout(180L, { // Start 2nd Timed Lambda Function - Turn OFF LED 1 second later (once per loop)

Blynk.virtualWrite(V0, 0); // Turn Virtual LED OFF

digitalWrite(LEDArduino , HIGH); // Turn ESP On-Board LED OFF }); // END 2nd Timer Function

Blynk.virtualWrite(V0, 255); // Turn Virtual LED ON digitalWrite(LEDArduino, LOW); // Turn ESP On-Board LED ON

}); // END 1st Timer Function }

BLYNK_WRITE(V0) {
int pinValue = param.asInt();
Serial.print("Pin number: "); Serial.println(LEDArduino); Serial.println(pinValue);

if (pinValue == 1) {
digitalWrite(LEDArduino, HIGH); // Turn LED on. } else {
digitalWrite(LEDArduino, LOW); // Turn LED off. }
}

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





Thank you!

Is that supposed to be in a comment or in the codechar ssid[] = "I'm AweSome";

And what about WiFi.begin(ssid, pass);That’s as well in a comment...

Please post code that casually compiles and you are using...

used code example which seems to be similar to what i am trying to do tried to modify
the loop runs as programmed but i want to be able to stop it completely (digital pin) added a button when i use it to stop it stops for some time and then goes on by it self and starts running again
could you please tell where is the mistake or what is missing in order to stop the timer running?