Before creating the topic
Hardware: 1 NODEMCU & 2 ESP32
Smartphone OS: IOS
Blynk Server
I’m attempting to use the bridge function to to trigger updates on other ESPs simultaneously from the blynk app. I’ve added bridge1.setauthtoken("") and bridge2.setauthoken("") which are two of the tokens that I would like to trigger the updates on. When I attempt to trigger the updates, I notice that only one of the tokens get triggered at a time.
is it possible to bridge to two different tokens from one device? I read the other topics but they seem to be different from what I am trying to do.
this is the code running in the NODEMCU where I trigger the update from
#include <FS.h>
#include <SPI.h>
#include <ArduinoJson.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <WiFiManager.h>
#define BLYNK_PRINT Serial
bool shouldSaveConfig = false;
int Lw_pin = 15;
int LedOk = 12;
int WifiReset_Pin = 13;
BlynkTimer timer;
char FWU_token[34] = "YOUR_TOKEN";
void saveConfigCallback()
{
shouldSaveConfig = true;
}
WidgetBridge bridge1(V26);
WidgetBridge bridge2(V26);
BLYNK_CONNECTED()
{
bridge1.setAuthToken("blynktoken");
bridge2.setAuthToken("blynktoken");
}
BLYNK_WRITE(V26)
{
int pinValue = param.asInt();
if (pinValue == 1)
{
bridge1.virtualWrite(V26, 1);
bridge2.virtualWrite(V26, 1);
}
else
{
}
}
void setup()
{
WiFiManager wifiManager;
pinMode(Lw_pin, OUTPUT);
pinMode(WifiReset_Pin, INPUT_PULLUP);
pinMode(LedOk, OUTPUT);
LEDFlash();
digitalWrite(LedOk, LOW);
delay(100);
int clearwifi = digitalRead(WifiReset_Pin);
delay(100); //debounce input
if (clearwifi == 0)
{
digitalWrite(LedOk, LOW);
wifiManager.resetSettings();
if (SPIFFS.begin())
{
if (SPIFFS.exists("/config.json"))
{
SPIFFS.remove("/config.json");
}
}
else
{
}
ESP.restart();
digitalWrite(Lw_pin, HIGH);
delay(5000);
}
if (clearwifi == 1)
{
if (SPIFFS.begin())
{
if (SPIFFS.exists("/config.json"))
{
File configFile = SPIFFS.open("/config.json", "r");
if (configFile)
{
size_t size = configFile.size();
std::unique_ptr<char[]> buf(new char[size]);
configFile.readBytes(buf.get(), size);
DynamicJsonBuffer jsonBuffer;
JsonObject &json = jsonBuffer.parseObject(buf.get());
json.printTo(Serial);
if (json.success())
{
strcpy(FWU_token, json["FWU_token"]);
}
else
{
}
}
}
}
else
{
}
WiFiManagerParameter custom_FWU_token("FWU", "FWU_token", FWU_token, 33);
wifiManager.setSaveConfigCallback(saveConfigCallback);
wifiManager.addParameter(&custom_FWU_token);
wifiManager.setTimeout(360);
if (!wifiManager.autoConnect("FWU-AP"))
{
delay(1000);
delay(1000);
ESP.restart();
}
strcpy(FWU_token, custom_FWU_token.getValue());
if (shouldSaveConfig)
{
DynamicJsonBuffer jsonBuffer;
JsonObject &json = jsonBuffer.createObject();
json["FWU_token"] = FWU_token;
File configFile = SPIFFS.open("/config.json", "w");
if (!configFile)
{
}
json.printTo(Serial);
json.printTo(configFile);
configFile.close();
}
Blynk.config(FWU_token);
bool result = Blynk.connect();
}
}
void loop()
{
Blynk.run();
timer.run();
}