How to blink led continuous

How to blink led continuous using BLYNK_WRITE(V0)?I want led to blink continuously(like in void loop) when i press (vo) on blynk app

int LEDpin=D0;
#define BLYNK_PRINT Serial


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


char auth[] = "something";



char ssid[] = "something";
char pass[] = "something";


BLYNK_WRITE(V0)
{
  int pinValue = param.asInt(); 
 
  Serial.print("V1 Slider value is: ");
  Serial.println(pinValue);
  if(pinValue==1){
  digitalWrite(LEDpin, HIGH);   
  delay(1000);                       
  digitalWrite(LEDpin, LOW);   
  delay(1000);} 
}

void setup()
{
  pinMode(LEDpin, OUTPUT);
  Serial.begin(9600);

  Blynk.begin(auth, ssid, pass);
  
}

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

Please edit your post (using the pencil icon at the bottom) so that the code displays correctly, like this:

Blynk%20-%20FTFC

Pete.

sir please help with the question thank you

Please do t start new threads with the identical question. Use this thread, and edit your original post so that the code displays correctly.

I have deleted your other thread.

Pete.

sir is it ok now?

How to blink led continuous using BLYNK_WRITE(V0)?

with a blynk timer

StartBlinkLed = timer.setInterval(1000L, BlinkLed); //blink every 1 s


BLYNK_WRITE(V0)
{
  int pinValue = param.asInt(); 
  Serial.print("V1 Slider value is: ");
  Serial.println(pinValue);
  if(pinValue==1){
timer.enable(StartBlinkLed ); // Turn BlinkLed Timer  on;
}else{
timer.disable(StartBlinkLed ); // Turn BlinkLed Timer off;
     }
}

void BlinkLed(){
If (Ledflag==0){
digitalWrite(LEDpin, HIGH);  
}else{
 digitalWrite(LEDpin, LOW); 
   }
}
```
2 Likes

“How to type a question in the body of the post instead of a long run on sentence in the title…” oh well, that failed :frowning:

At least there are lots of ways to Blynk LEDs :stuck_out_tongue:

1 Like

thank you very much sir.

1 Like