Hello, I want to create a program, that saves 10 values every second in one timestamp. From documentations and other forum entries I gathered that it would be possible with the HTTPS API, but I also wanted to try the rather new beginGroup/endGroup functionality. This functionality works really well and my produced timestamps are as I want them.
BUT it was not able to make a timestamp every second. Rather my project skipped a second every few times, sometimes even up to 3 seconds. (I added a screenshot below)
Question: Is there a way to create a 10 value timestamp with begin/end Group?
• Hardware model: ESP32
• Blynk server
• Blynk Library version
#define BLYNK_TEMPLATE_ID "TMPLe8hU46mU"
#define BLYNK_TEMPLATE_NAME "Blynk beginGroupendGroup Test Template"
#define BLYNK_AUTH_TOKEN "uq8IRaXwc45_KQvtC0ZGdFWUSpwq0LQM"
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#include <ezTime.h>
char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "secret";
char pass[] = "very secret";
BlynkTimer timer;
int32_t distances[10];
int counter = 0;
int32_t randNumber;
void setup() {
Serial.begin(115200);
Blynk.begin(auth, ssid, pass);
timer.setInterval(100L, getDistanceValue);
}
void getDistanceValue() {
randNumber = int32_t(random(0,255));
distances[counter] = randNumber;
counter++;
if(counter >= 10){
counter = 0;
updateBlynkValuesAsGroup();
}
}
void updateBlynkValuesAsGroup() {
uint64_t ts = (uint64_t)UTC.now() * 1000 + UTC.ms(LAST_READ);
Blynk.beginGroup(ts);
Blynk.virtualWrite(V0, distances[0]);
Blynk.virtualWrite(V1, distances[1]);
Blynk.virtualWrite(V2, distances[2]);
Blynk.virtualWrite(V3, distances[3]);
Blynk.virtualWrite(V4, distances[4]);
Blynk.virtualWrite(V5, distances[5]);
Blynk.virtualWrite(V6, distances[6]);
Blynk.virtualWrite(V7, distances[7]);
Blynk.virtualWrite(V8, distances[8]);
Blynk.virtualWrite(V9, distances[9]);
Blynk.endGroup();
}
void loop() {
Blynk.run();
timer.run();
}