Hi,
The last time I was busy with my SonOff t1. I want to switch the relays on the SonOff via blynk so that I can turn my light on and off with my mobile and by hand.
To begin with, I flashed a LED Blink sketch, but it now automatically stays on and off without me doing anything.
Does anyone know what I’m doing wrong?
Thanks in advance
Here is my code:
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = "####";
char ssid[] = "####";
char pass[] = "####";
WidgetLED led1(V1);
int Led13 = 13;
BlynkTimer timer;
void blinkLedWidget()
{
if (led1.getValue()) {
led1.off();
digitalWrite(Led13, LOW);
Serial.println("LED on V1: off");
} else {
led1.on();
digitalWrite(Led13, HIGH);
Serial.println("LED on V1: on");
}
}
void setup()
{
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
pinMode(Led13, OUTPUT);
timer.setInterval(1000L, blinkLedWidget);
}
void loop()
{
Blynk.run();
timer.run();
}