Rajat
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();
}
Please edit your post (using the pencil icon at the bottom) so that the code displays correctly, like this:
Pete.
Rajat
3
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.
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
Gunner
7
1 Like