BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

How to blink led continuous

#1

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();
}
0 Likes

#2

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

Blynk%20-%20FTFC

Pete.

0 Likes

#3

sir please help with the question thank you

0 Likes

#4

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.

0 Likes

#5

sir is it ok now?

0 Likes

#6

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

#7

“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

#8

thank you very much sir.

1 Like