After pressing the V2 button the relay: ON-OFF-ON
V2 stays on 1
Does your relay operate when a LOW or a HIGH signal is apples to the input pin?
Have you removed the Blynk.syncVirtual command?
Pete.
I think HIGH
Blynk.syncVirtual command removed
It’s about V2 or D3
Test your relay by connecting the input (data) pin to VCC and then to GND.
Which makes the relay become energised?
Pete.
If it turns on the V2 button = 1, it turns on relay D3
If you won’t do this test…
Then I’m not going to spend any time debugging your code.
Pete.
Now it is working
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
char auth[] = "";
char ssid[] = "";
char pass[] = "";
SimpleTimer timer;
int Value;
int Relay = D3;
BLYNK_WRITE(V2)
{
Value = param.asInt();
if ( Value == 1 )
{
timer.setTimer(1000L, RelayON, 3);
timer.setTimer(3500L, pinupdate, 1);
}
}
BLYNK_CONNECTED () {
Blynk.syncAll ();
}
void setup()
{
Serial.begin(9600);
pinMode(Relay,OUTPUT);
digitalWrite(Relay,LOW);
Blynk.begin(auth, ssid, pass);
}
void RelayON() {
digitalWrite(Relay, HIGH);
timer.setTimeout(500L, RelayOFF);
}
void RelayOFF() {
digitalWrite(Relay, LOW);
}
void pinupdate() {
Blynk.virtualWrite(V2,0);
}
void loop()
{
timer.run();
Blynk.run();
}
Perfect! Now if you want to help the next one who stumbles onto this post for help you can explain what you were doing wrong and how you fixed it.