Started a new topic as lost my way with the first post due to the V0 sync problem.
Blynk 2.0 paid option, latest versions of app and library, using an esp32 with led on pin 25 and an android S7 for Blynk app. Simple test code as below. My aim is to set the device tile in the app as a switch with an identical function to a button widget on the app page.
So tile type selected is button, datastream is V1, mode is switch. Button widget is set as switch on V1 and dashboard widget is a switch on V1. Widget and dashboard switch synchronise, switch led on and off as expected so work perfectly but they do not change status of tile, tile changes status on app screen when pressed but does no sync with widget or dashboard nor does it change led to either on or off. Occasionally after force stopping the app and restarting the tile will reflect the dashboard switch but not the other way round. There is a you tube video from techiesms “making your first project on New Blynk 2.0” that does exactly what I am trying to achieve but I am unable to duplicate his results. Great forum and appreciate the help given so far.
#define BLYNK_TEMPLATE_ID "REDACTED"
#define BLYNK_DEVICE_NAME "REDACTED"
#define BLYNK_FIRMWARE_VERSION "0.1.0"
#define BLYNK_PRINT Serial
#define BLYNK_DEBUG
#define APP_DEBUG
// Uncomment your board, or configure a custom board in Settings.h
//#define USE_WROVER_BOARD
//#define USE_TTGO_T7
#include "BlynkEdgent.h"
void setup()
{
pinMode(25, OUTPUT);
Serial.begin(115200);
delay(100);
BlynkEdgent.begin();
}
void loop() {
BlynkEdgent.run();
}
BLYNK_WRITE(V1)
{
if(param.asInt()==1)
{
digitalWrite(25,HIGH);
}
else
{
digitalWrite(25,LOW);
}
}
BLYNK_CONNECTED()
{
Blynk.syncVirtual(V1); // will cause BLYNK_WRITE(V0) to be executed
}