@Dmitriy confirmed latest version of server has fixed the “stop project” bug on local servers.
Below is a sketch for the issue with ESP (WeMos D1 Mini) disconnecting from server.
At line 17 a figure of around 2500 (ms) the ESP is stable but when you drop this figure to 1500 the ESP keeps disconnecting. Somewhere between 1500 and 2500 it is hit and miss.
With a slider on V4 (range 0 to 5) and left on 0 the project will:
Cycle through the 5 colours for an LED on V0.
Write the colour number (1 to 5) on Value Display V6.
Change the label text on Value Display V5 to the name of the colour (Red, Blue etc).
Write the name of the colour on Value Display V5 in the colour of the LED
/*
SetPropertyV1.ino by Costas 30/8/16
Testing Set Property
*/
//#define BLYNK_DEBUG
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
#define BLYNK_GREEN "#23C48E" // 1
#define BLYNK_BLUE "#04C0F8" // 2
#define BLYNK_YELLOW "#ED9D00" // 3
#define BLYNK_RED "#D3435C" // 4
#define BLYNK_DARK_BLUE "#5F7CD8" // 5
#define MyTimer 1500 // x second intervals
SimpleTimer timer;
char auth[] = "xxxxxxxxxxxxxx";
char ssid[] = "xxxxxxxxxxxxxx";
char pass[] = "xxxxxxxxxxxxxx";
String chosencolour;
String LEDcolour;
int slidercolour = 1;
bool boolautocolour = true;
void mycolours()
{
if(boolautocolour == false){
pickcolour();
}
else{
autocolour();
}
Blynk.setProperty(V0, "color", LEDcolour); // green LED is default
Blynk.virtualWrite(V5, chosencolour);
Blynk.virtualWrite(V6, slidercolour);
Blynk.virtualWrite(V0, 255); // LED On
delay(500);
Blynk.virtualWrite(V0, 0); // LED Off
}
void autocolour(){ // slidercolour was 0
boolautocolour = true;
slidercolour++;
if(slidercolour == 6){
slidercolour = 1; // reset back to green
}
pickautocolour();
}
void pickautocolour(){
if(slidercolour == 1){
LEDcolour = BLYNK_GREEN;
chosencolour = "Green";
Blynk.setProperty(V5, "color", BLYNK_GREEN);
Blynk.setProperty(V5, "label", "Green");
}
else if(slidercolour == 2){
LEDcolour = BLYNK_BLUE;
chosencolour = "Blue";
Blynk.setProperty(V5, "color", BLYNK_BLUE);
Blynk.setProperty(V5, "label", "Blue");
}
else if(slidercolour == 3){
LEDcolour = BLYNK_YELLOW;
chosencolour = "Yellow";
Blynk.setProperty(V5, "color", BLYNK_YELLOW);
Blynk.setProperty(V5, "label", "Yellow");
}
else if(slidercolour == 4){
LEDcolour = BLYNK_RED;
chosencolour = "Red";
Blynk.setProperty(V5, "color", BLYNK_RED);
Blynk.setProperty(V5, "label", "Red");
}
else if(slidercolour == 5){
LEDcolour = BLYNK_DARK_BLUE;
chosencolour = "Dark Blue";
Blynk.setProperty(V5, "color", BLYNK_DARK_BLUE);
Blynk.setProperty(V5, "label", "Dark Blue");
}
}
void pickcolour(){
if(slidercolour != 0){
boolautocolour == false;
}
pickautocolour();
}
BLYNK_WRITE(V4){ // slider to pick LED colour 1 Green 2 Blue 3 Yellow 4 Red 5 Dark blue
slidercolour = param.asInt();
if(slidercolour != 0){
boolautocolour = false;
}
else{
boolautocolour = true;
}
}
void setup()
{
Serial.begin(115200);
Blynk.begin(auth, ssid, pass, "192.168.10.10"); // local server IP
while (Blynk.connect() == false) {
// Wait until connected
}
timer.setInterval(MyTimer, mycolours);
}
void loop()
{
Blynk.run();
timer.run();
}