I can’t add more LED with delay blink.
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "";
char pass[] = "";
WidgetLED led1(D7);
WidgetLED ledBlinking(D5);
#define LED_PINBLINK D5
int t1;
BlynkTimer timer;
// V1 LED Widget is blinking
void blinkLedWidget()
{
if (led1.getValue()) {
led1.off();
Serial.println("LED on D7: off");
} else {
led1.on();
Serial.println("LED on D7: on");
}
}
void setup()
{
// Debug console
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
// You can also specify server:
//Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 8442);
//Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8442);
timer.setInterval(1000L, blinkLedWidget);
pinMode(LED_PINBLINK, OUTPUT);
t1 = timer.setInterval(1000, ledBlynk);
timer.disable(t1);
}
BLYNK_WRITE(1)
{
if (param.asInt()) {
timer.enable(t1);
} else {
timer.disable(t1);
digitalWrite(LED_PINBLINK, LOW);
}
}
// Change blink interval using virtual pin 2
BLYNK_WRITE(2)
{
int interval = param.asInt();
boolean wasEnabled = timer.isEnabled(t1);
timer.deleteTimer(t1);
t1 = timer.setInterval(interval, ledBlynk);
if (!wasEnabled) {
timer.disable(t1);
}
}
void ledBlynk()
{
digitalWrite(LED_PINBLINK, !digitalRead(LED_PINBLINK));
}
void loop()
{
Blynk.run();
timer.run();
}