#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
char auth[] = "*******************************";
char ssid[] = "******************";
char pass[] = "*******************";
char server[] = "blynk-cloud.com";
int port = 8080;
int out1=0;
int before1;
int out2=2;
int before2;
SimpleTimer timer;
void setup(){
Serial.begin(9600);
before1=1;
pinMode(out1,OUTPUT);
before2=1;
pinMode(out2,OUTPUT);
digitalWrite(out1, HIGH);
digitalWrite(out2, HIGH);
Blynk.begin(auth, ssid, pass, server, port);
}
void before11(){
digitalWrite(out1,HIGH);
before1=1;
Blynk.virtualWrite(V5,0);
}
void before21(){
digitalWrite(out2, HIGH);
before2=1;
Blynk.virtualWrite(V6,0);
}
BLYNK_WRITE(V5)
{
int pinData = param.asInt();
if (pinData==1){
digitalWrite(out1,LOW);
before1=0;
timer.setTimeout(15000L,before11);
}
if (pinData==0){
digitalWrite(out1,HIGH);
before1=1;
}
}
BLYNK_WRITE(V6)
{
int pinData = param.asInt();
if (pinData==1){
digitalWrite(out2,LOW);
before2=0;
timer.setTimeout(15000L,before21);
}
if (pinData==0){
digitalWrite(out2,HIGH);
before2=1;
}
}
void loop() {
Blynk.run();
timer.run();
}