Is there any progress in solving this issue? I am also having the same problem on other hardware: the program I show here should increase a counter on a “Value Display S” widget in the app every 3 seconds. However, when sending value 5,5,5,5 you see 5,5,5,4 in the app. So this clearly shows that the last part of the BLE buffer isn’t flushed somewhere (I guess in the Android app).
I am using
Software:
- Android app version 1.13.2 (12/7/2016) running on Android version 5.1.1 on Samsung SM-G800F
- Blynk library 0.3.8
Hardware
- Arduino nano
- HM10 BLE module
My code looks like
#define BLYNK_DEBUG
#define BLYNK_PRINT Serial
#define BLYNK_USE_DIRECT_CONNECT
#include <SoftwareSerial.h>
#include <BlynkSimpleSerialBLE.h>
#include <SimpleTimer.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "0d843a65fc98494e91be76faced09ffe";
SoftwareSerial SerialBLE(2, 3); // RX, TXconnected to HM-10
long count;
SimpleTimer timer;
void updateCount()
{
++count;
Serial.println("updateCount");
Blynk.virtualWrite(V6,count);
Blynk.virtualWrite(V7,count);
Blynk.virtualWrite(V8,count);
Blynk.virtualWrite(V9,count);
}
void setup()
{
Serial.begin(9600);
SerialBLE.begin(9600);
Blynk.begin(auth, SerialBLE);
while (Blynk.connect() == false) {
// Wait until connected
}
count = 0;
timer.setInterval(3000L, updateCount);
}
void loop()
{
Blynk.run();
timer.run();
}
and the output looks like
[0] Blynk v0.3.8 on Arduino Uno
[0] Connecting...
[2520] >[02|00|01|00]
[2571] >0d843a65fc98494e91be76faced09ffe
[2572] Ready
[2572] <[00|00|01|00|C8]
[4658] >[14|00|02|00|04]
[4662] >vr[00]5
updateCount
[5634] <[14|00|01|00|06]vw[00]6[00]1
[5686] <[14|00|02|00|06]vw[00]7[00]1
[5739] <[14|00|03|00|06]vw[00]8[00]1
[5791] <[14|00|04|00|06]vw[00]9[00]1
[5843] >[14|00|03|00|04]
[5844] >vr[00]5
[6645] >[14|00|04|00|04]
[6649] >vr[00]5
[7658] >[14|00|05|00|04]
[7662] >vr[00]5
updateCount
[8634] <[14|00|05|00|06]vw[00]6[00]2
[8686] <[14|00|06|00|06]vw[00]7[00]2
[8739] <[14|00|07|00|06]vw[00]8[00]2
[8792] <[14|00|08|00|06]vw[00]9[00]2
[8844] >[14|00|06|00|04]
[8845] >vr[00]5
[9683] >[14|00|07|00|04]
[9688] >vr[00]5
[10658] >[14|00|08|00|04]
[10663] >vr[00]5
updateCount
[11634] <[14|00|09|00|06]vw[00]6[00]3
[11686] <[14|00|0A|00|06]vw[00]7[00]3
[11740] <[14|00|0B|00|06]vw[00]8[00]3
[11792] <[14|00|0C|00|06]vw[00]9[00]3
[11845] >[14|00|09|00|04]
[11845] >vr[00]5
[12684] >[14|00|0A|00|04]
[12688] >vr[00]5
[13659] >[14|00|0B|00|04]
[13664] >vr[00]5
updateCount
[14635] <[14|00|0D|00|06]vw[00]6[00]4
[14687] <[14|00|0E|00|06]vw[00]7[00]4
[14740] <[14|00|0F|00|06]vw[00]8[00]4
[14792] <[14|00|10|00|06]vw[00]9[00]4
[14845] >[14|00|0C|00|04]
[14845] >vr[00]5
[15684] >[14|00|0D|00|04]
It doesn’t matter if the variable count is of type int or long, the issue remains the same.