Hi All,
I have a very strange problem. I noticed that sometimes I don’t get requests from widget (BLYNK_READ).
For example I have ‘Value Display’ widget with ‘Reading Rate’ = 1 sec.
I use the following source code:
#define BLYNK_DEBUG
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = "AUTH_CODE-fvK4W";
char ssid[] = "SSID";
char pass[] = "PASSWORD";
int read_request_counter = 0;
int button_clicks = 0;
BLYNK_READ (V30)
{
Serial.println("*** Read request from Blynk ***");
Blynk.virtualWrite(V30, read_request_counter++);
}
BLYNK_WRITE (V32)
{
Serial.println("*** Click Button ***");
Blynk.virtualWrite(V31, button_clicks++);
}
void setup(void)
{
Serial.begin(115200);
while (!Serial) {}
Serial.setDebugOutput(true);
Blynk.begin(auth, ssid, pass);
}
void loop(void)
{
Blynk.run();
}
I run my hardware (Node MCU v3 Lolin CH340G) and my log from serial monitor:
15:43:46.503 -> scandone
15:43:46.503 -> state: 0 -> 2 (b0)
15:43:46.503 -> state: 2 -> 3 (0)
15:43:46.503 -> state: 3 -> 5 (10)
15:43:46.539 -> add 0
15:43:46.539 -> aid 1
15:43:46.539 -> cnt
15:43:46.719 ->
15:43:46.719 -> connected with SSID, channel 3
15:43:46.753 -> dhcp client start...
15:43:46.996 -> ip:192.168.1.48,mask:255.255.255.0,gw:192.168.1.1
15:43:47.177 -> [3568] Connected to WiFi
15:43:47.177 -> [3568] IP: 192.168.1.48
15:43:47.177 -> [3568]
15:43:47.177 -> ___ __ __
15:43:47.177 -> / _ )/ /_ _____ / /__
15:43:47.177 -> / _ / / // / _ \/ '_/
15:43:47.177 -> /____/_/\_, /_//_/_/\_\
15:43:47.177 -> /___/ v0.6.1 on NodeMCU
15:43:47.177 ->
15:43:47.177 -> [3574] Connecting to blynk-cloud.com:80
15:43:47.210 -> :ref 1
15:43:47.312 -> [3716] <[1D|00|01|00] AUTH_CODE-fvK4W
15:43:47.312 -> :wr 37 0
15:43:47.350 -> :wrc 37 37 0
15:43:47.459 -> :ack 37
15:43:47.459 -> :rn 5
15:43:47.459 -> :c0 1, 5
15:43:47.459 -> [3874] >[00|00|01|00|C8]
15:43:47.459 -> [3874] Ready (ping: 150ms).
15:43:47.459 -> [3874] Free RAM: 48760
15:43:47.493 -> :rn 10
15:43:47.493 -> [3883] >[14|1E]b[00|05]
15:43:47.493 -> :c0 1, 10
15:43:47.493 -> [3886] >vr[00]30
15:43:47.493 -> *** Read request from Blynk ***
15:43:47.565 -> [3953] <[14|1E]b[00|07]vw[00]30[00]0
15:43:47.565 -> :wr 12 0
15:43:47.565 -> :wrc 12 12 0
15:43:47.565 -> [3959] <[11|00|02|00]Hver[00]0.6.1[00]h-beat[00]10[00]buff-in[00]1024[00]dev[00]NodeMCU[00]build[00]Apr 9 2020 15:21:14[00]
15:43:47.565 -> :wr 77 0
15:43:47.598 -> :wrc 77 77 0
15:43:47.745 -> :ack 12
15:43:47.889 -> :ack 77
15:43:47.889 -> :rn 5
15:43:47.889 -> :c0 1, 5
15:43:47.889 -> [4302] >[00|00|02|00|C8]
15:43:48.497 -> :rn 10
15:43:48.497 -> [4893] >[14|1E]b[00|05]
15:43:48.497 -> :c0 1, 10
15:43:48.497 -> [4896] >vr[00]30
15:43:48.497 -> *** Read request from Blynk ***
I see ‘Read request from Blynk’ messages… It works as expected.
But then I reboot (or power off -> power on) my hardware and I see the following serial log:
15:44:20.548 -> scandone
15:44:20.548 -> state: 0 -> 2 (b0)
15:44:20.548 -> state: 2 -> 3 (0)
15:44:20.548 -> state: 3 -> 5 (10)
15:44:20.584 -> add 0
15:44:20.584 -> aid 1
15:44:20.584 -> cnt
15:44:20.794 ->
15:44:20.794 -> connected with SSID, channel 3
15:44:20.794 -> dhcp client start...
15:44:21.049 -> ip:192.168.1.48,mask:255.255.255.0,gw:192.168.1.1
15:44:21.232 -> [3568] Connected to WiFi
15:44:21.232 -> [3568] IP: 192.168.1.48
15:44:21.232 -> [3568]
15:44:21.232 -> ___ __ __
15:44:21.232 -> / _ )/ /_ _____ / /__
15:44:21.232 -> / _ / / // / _ \/ '_/
15:44:21.232 -> /____/_/\_, /_//_/_/\_\
15:44:21.232 -> /___/ v0.6.1 on NodeMCU
15:44:21.232 ->
15:44:21.232 -> [3574] Connecting to blynk-cloud.com:80
15:44:21.270 -> :ref 1
15:44:21.377 -> [3711] <[1D|00|01|00] AUTH_CODE-fvK4W
15:44:21.377 -> :wr 37 0
15:44:21.377 -> :wrc 37 37 0
15:44:21.479 -> :ack 37
15:44:21.479 -> :rn 5
15:44:21.479 -> :c0 1, 5
15:44:21.479 -> [3848] >[00|00|01|00|C8]
15:44:21.515 -> [3848] Ready (ping: 130ms).
15:44:21.515 -> [3849] Free RAM: 48760
15:44:21.551 -> [3915] <[11|00|02|00]Hver[00]0.6.1[00]h-beat[00]10[00]buff-in[00]1024[00]dev[00]NodeMCU[00]build[00]Apr 9 2020 15:21:14[00]
15:44:21.589 -> :wr 77 0
15:44:21.589 -> :wrc 77 77 0
15:44:21.660 -> :ack 77
15:44:21.660 -> :rn 5
15:44:21.660 -> :c0 1, 5
15:44:21.660 -> [4021] >[00|00|02|00|C8]
15:44:30.582 -> pm open,type:2 0
15:44:31.576 -> [13929] <[06|00|03|00|00]
15:44:31.576 -> :wr 5 0
15:44:31.613 -> :wrc 5 5 0
15:44:31.682 -> :ack 5
15:44:31.682 -> :rn 5
15:44:31.682 -> :c0 1, 5
15:44:31.682 -> [14024] >[00|00|03|00|C8]
From logs you can see that widget doesn’t send any request to V30! but hardware is working, because I can click on button (V32) and I see that counter V31 will increase, see my logs in this moment:
15:44:35.358 -> :rn 12
15:44:35.358 -> [17695] >[14|00|0D|00|07]
15:44:35.358 -> :c0 1, 12
15:44:35.358 -> [17699] >vw[00]32[00]1
15:44:35.358 -> *** Click Button ***
15:44:35.430 -> [17766] <[14|00|0D|00|07]vw[00]31[00]0
15:44:35.430 -> :wr 12 0
15:44:35.430 -> :wrc 12 12 0
15:44:35.499 -> :rn 12
15:44:35.499 -> [17854] >[14|00|0E|00|07]
15:44:35.499 -> :c0 1, 12
15:44:35.499 -> [17857] >vw[00]32[00]0
15:44:35.536 -> *** Click Button ***
15:44:35.572 -> [17924] <[14|00|0E|00|07]vw[00]31[00]1
15:44:35.572 -> :wr 12 0
15:44:35.572 -> :wrc 12 12 0
15:44:35.609 -> :ack 12
15:44:35.750 -> :ack 12
i.e. my program in node mcu is working but for some reasons I don’t get any requests from widget!
If I will reboot hardware again and again I can catch case when it will work again (see my first log).
I tried the same case on other nodemcu device and I saw the same results
I tried to create a new test project in Blynk, only for this case, and … it works always! so I think that it is somehow connected specifically with my project, but I want to understand and fix this problem for future projects
I can send AUTH code for this application, but I’m not sure that I should do it here, i.e. it will be useful for support only.
Details:
- Node MCU v3 Lolin CH340G (ESP8266 WIFI)
- I use Android 9.0 (SM-G950FD).
- Official Blynk server
- Blynk library v0.6.1
Please, let me know if you need more info from me.
Thanks!