I need to be able to store and retrieve some data that is not displayed.
I do this by getting the BLYNK server to read the data from virtual pins.
I then try to retrieve the data after a power cycle using BLYNK_CONNECTED and requesting that BLYNK sync some of the Virtual pins.
The data appears to get read by the server but it is never restored.
The terminal output looks like this
write 0
write 1
write 2
write 0
No read output is recorder.
The pin defined as “vcount” does get restored.
• Hardware model + communication type. Esp8266 WiFi
• Smartphone OS (iOS ) + 11.4
• Blynk server
• Blynk Library version 0.5.4
#define DATASTORE V25
#define vcount V24
#define maxCards 20
#define dataPins V25, V26, V27, V28, V29, V30, V31, V32, V33, V34, V35, V36, V37, V38, V39, V40, V41, V42, V43, V44, V45
BLYNK_CONNECTED() {
Blynk.syncVirtual(vcount, dataPins);
}
BLYNK_WRITE(vcount) {
rowIndex = param.asInt();
}
BLYNK_READ_DEFAULT()
{
int pin = request.pin; // Which exactly pin is handled?
if ((pin >= DATASTORE) & (pin <= (DATASTORE + maxCards))){
int i = (pin - DATASTORE)+1;
terminal.print("read "); // Print values, like Serial.println()
terminal.println(i); // Print values, like Serial.println()
Blynk.virtualWrite(pin, cardHolder[i], cardId[i], i);
}
}
BLYNK_WRITE_DEFAULT()
{
int pin = request.pin; // Which exactly pin is handled?
if ((pin >= DATASTORE) & (pin <= (DATASTORE + maxCards))){
int i = param[2].asInt();
cardHolder[i] = param[0].asStr();
cardId[i] = param[1].asStr();
terminal.print("write "); // Print values, like Serial.println()
terminal.println(i); // Print values, like Serial.println()
}
// int value = param.asInt(); // Use param as usual.
}