I have created a timer in the app. This is done correctly and everything is fine. When the timer expires and I disconnect from the local server, now enter a new timer, and reconnect to the local server, the new timer will not run. Had reset the timer in the app and re-entered. Is it up to me or why does not the new timer start?
Here is the sketch I use.
The red dot above can be forgotten, because 1 ESP8266 is not connected. The other 6 but already
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
//#include <TimeLib.h>
//#include <WidgetRTC.h>
//char auth[] = "xxxxxxxxxxxx"; //K1-K8
char auth[] = "xxxxxxxxxxxxx"; //K9-K12
char ssid[] = "xxxxxxxxxx";
char pass[] = "xxxxxxxxxx";
const int btnPin1 = D10; //GPIO1 > K1
const int btnPin2 = D4; //GPIO2 > K2
const int btnPin3 = D9; //GPIO3 > K3
const int btnPin4 = D2 //GPIO4 > K4
const int btnPin5 = D1; //GPIO5 > K5
const int btnPin6 = D6; //GPIO12 > K6
const int btnPin7 = D7; //GPIO13 > K7
const int btnPin8 = D5; //GPIO14 > K8
WidgetLED led1(V4); // > K1 > GPIO1
WidgetLED led2(V5); // > K2 > GPIO2
WidgetLED led3(V6); // > K3 > GPIO3
WidgetLED led4(V7); // > K4 > GPIO4
WidgetLED led5(V8); // > K5 > GPIO5
WidgetLED led6(V9); // > K6 > GPIO12
WidgetLED led7(V10); // > K7 > GPIO13
WidgetLED led8(V11); // > K8 > GPIO14
BlynkTimer timer;
boolean btnState1 = false;
void buttonLedWidget1()
{
// Read button
boolean isPressed = (digitalRead(btnPin1) == LOW);
// If state has changed...
if (isPressed != btnState1) {
if (isPressed) {
led1.on();
} else {
led1.off();
}
btnState1 = isPressed;
}
}
boolean btnState2 = false;
void buttonLedWidget2()
{
// Read button
boolean isPressed = (digitalRead(btnPin2) == LOW);
// If state has changed...
if (isPressed != btnState2) {
if (isPressed) {
led2.on();
} else {
led2.off();
}
btnState2 = isPressed;
}
}
boolean btnState3 = false;
void buttonLedWidget3()
{
// Read button
boolean isPressed = (digitalRead(btnPin3) == LOW);
// If state has changed...
if (isPressed != btnState3) {
if (isPressed) {
led3.on();
} else {
led3.off();
}
btnState3 = isPressed;
}
}
boolean btnState4 = false;
void buttonLedWidget4()
{
// Read button
boolean isPressed = (digitalRead(btnPin4) == LOW);
// If state has changed...
if (isPressed != btnState4) {
if (isPressed) {
led4.on();
} else {
led4.off();
}
btnState4 = isPressed;
}
}
boolean btnState5 = false;
void buttonLedWidget5()
{
// Read button
boolean isPressed = (digitalRead(btnPin5) == LOW);
// If state has changed...
if (isPressed != btnState5) {
if (isPressed) {
led5.on();
} else {
led5.off();
}
btnState5 = isPressed;
}
}
boolean btnState6 = false;
void buttonLedWidget6()
{
// Read button
boolean isPressed = (digitalRead(btnPin6) == LOW);
// If state has changed...
if (isPressed != btnState6) {
if (isPressed) {
led6.on();
} else {
led6.off();
}
btnState6 = isPressed;
}
}
boolean btnState7 = false;
void buttonLedWidget7()
{
// Read button
boolean isPressed = (digitalRead(btnPin7) == LOW);
// If state has changed...
if (isPressed != btnState7) {
if (isPressed) {
led7.on();
} else {
led7.off();
}
btnState7 = isPressed;
}
}
boolean btnState8 = false;
void buttonLedWidget8()
{
// Read button
boolean isPressed = (digitalRead(btnPin8) == LOW);
// If state has changed...
if (isPressed != btnState8) {
if (isPressed) {
led8.on();
} else {
led8.off();
}
btnState8 = isPressed;
}
}
void setup()
{
pinMode(D1, OUTPUT);
digitalWrite(D1, HIGH);
pinMode(D2, OUTPUT);
digitalWrite(D2, HIGH);
pinMode(D4, OUTPUT);
digitalWrite(D4, HIGH);
pinMode(D5, OUTPUT);
digitalWrite(D5, HIGH);
pinMode(D6, OUTPUT);
digitalWrite(D6, HIGH);
pinMode(D7, OUTPUT);
digitalWrite(D7, HIGH);
pinMode(D9, OUTPUT);
digitalWrite(D9, HIGH);
pinMode(D10, OUTPUT);
digitalWrite(D10, HIGH);
// Debug console
Serial.begin(9600);
Blynk.begin(auth, ssid, pass, IPAddress(192, 168, 0, 19), 8080);
pinMode(btnPin1,D10);
pinMode(btnPin2,D4);
pinMode(btnPin3,D9);
pinMode(btnPin4,D2);
pinMode(btnPin5,D1);
pinMode(btnPin6,D6);
pinMode(btnPin7,D7);
pinMode(btnPin8,D5);
// Richten Sie eine Funktion ein, die alle 100 ms aufgerufen werden soll
timer.setInterval(500L, buttonLedWidget1);
timer.setInterval(500L, buttonLedWidget2);
timer.setInterval(500L, buttonLedWidget3);
timer.setInterval(500L, buttonLedWidget4);
timer.setInterval(500L, buttonLedWidget5);
timer.setInterval(500L, buttonLedWidget6);
timer.setInterval(500L, buttonLedWidget7);
timer.setInterval(500L, buttonLedWidget8);
}
void loop()
{
Blynk.run();
timer.run();
}