ESP8266: getting disconnected after adding analog input

using WeMOS-D1 mini, I made a small project with 5 outputs, 4 digital inputs and one analog input.
it run OK with digital widgets. when I add “labeled value” for analog input I got “device was disconnected” and communication stops
Any help is appreciated.

My program:

 * Blynk is a platform with iOS and Android apps to control
 * Arduino, Raspberry Pi and the likes over the Internet.
 * You can easily build graphic interfaces for all your
 * projects by simply dragging and dropping widgets.
 *   Downloads, docs, tutorials:
 *   Blynk community:  
 *   Social networks:  
 * Blynk library is licensed under MIT license
 * This example code is in public domain.
 * This example runs directly on ESP8266 chip.
 * You need to install this for ESP8266 development:
 * Please be sure to select the right ESP8266 module
 * in the Tools -> Board menu!
 * Change WiFi ssid, pass, and Blynk auth token to run :)

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <EEPROM.h>
//EEPROM.write(address, value)

char str[20],x0,x1;

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "813b9989d77c464ebd16b33d2da0b5e0";

void setup()
Blynk.begin(auth, "Morosh", "94034690");
//"", "Subject: Motion Detected", "Suspicious activiy detected!!...");
if( {EEPROM.write(0,0);EEPROM.commit();};

void loop()
long x;
sprintf(str,"temp=%u °C",x);
Blynk.virtualWrite(V0, str);

if(digitalRead(0)==LOW) Blynk.virtualWrite(V1, 0); else Blynk.virtualWrite(V1, 255);
if(digitalRead(2)==LOW) Blynk.virtualWrite(V2, 0); else Blynk.virtualWrite(V2, 255);
if(digitalRead(4)==LOW) Blynk.virtualWrite(V3, 0); else Blynk.virtualWrite(V3, 255);
if(digitalRead(5)==LOW) Blynk.virtualWrite(V4, 0); else Blynk.virtualWrite(V4, 255);
if(digitalRead(15)==LOW) Blynk.virtualWrite(V5, 0); else Blynk.virtualWrite(V5, 255);

if(digitalRead(16)==HIGH) Blynk.virtualWrite(V6, 0); else Blynk.virtualWrite(V6, 255);
if(digitalRead(14)==HIGH) Blynk.virtualWrite(V7, 0); else Blynk.virtualWrite(V7, 255);
if(digitalRead(12)==HIGH) Blynk.virtualWrite(V8, 0); else Blynk.virtualWrite(V8, 255);
if(digitalRead(13)==HIGH) Blynk.virtualWrite(V9, 0); else Blynk.virtualWrite(V9, 255);
bitWrite(x1, 0, digitalRead(0));
bitWrite(x1, 1, digitalRead(2)); 
bitWrite(x1, 2, digitalRead(4)); 
bitWrite(x1, 3, digitalRead(5)); 
bitWrite(x1, 4, digitalRead(15)); 
if(x1!=x0) {EEPROM.write(0,x1); EEPROM.commit(); x0=x1;};

Maximum of 100 commands per second, you have thousands because you are wrongly using loop().

You must time your events, see PUSH_DATA example as a guide.

1 Like

@gvnl Here is some relevant documentation… and more can be found at

Excerpt from this document…

Avoiding the void

:point_up: :fire: :warning: VERY IMPORTANT: You can’t send sensor data in your void loop()

– Why?
– Because Blynk sends data over the Internet, and when you put something into void loop(), your microcontroller will execute it :scream_cat: gazillion number of times. Which means that Blynk Cloud will be flooded with gazillion messages from your hardware.

And when Blynk Cloud notices that, it automatically :scissors:︎ cuts your connection. Sorry…

– OK, what should I do then?
– Send sensor data in intervals!

Using timers to send sensor data in intervals(Read more in the documentation)