Can i bridge between 2 devices in different projects

Hello guys.

my question is can i bridge 2 devices with their auth tokens, if they are devices of 2 different projects?

i searched the forums and havent found an answer to this. the closest answer i found was in this (Accessing a Single Device from Multiple Blynk Projects?) post, 3rd reply.

Then you need to search more :stuck_out_tongue:

The Bridge Widget and it’s commands does exactly what you seem to be looking for. Send data from one device/project to another device(s)/project(s).

Yes, it can also send data between devices (with discrete auths) in a single project as well.

But one thing to remember is that is that all the projects need to be in the same Server, as it is the Server that creates and controls/guides the projects/devices via their Auth codes.

Here is an example I made…

hey thanks for your reply. i went ahead and tried this myself to no success though. my code is given below. note that the led blinking part may not work but its the incremented numbers that i want to get bridged. and of course the devices are from 2 different projects
Code for device 1:

#define BLYNK_PRINT Serial

#include <BlynkSimpleEsp32.h>

char auth[] = "<device 1 auth>"; // new auth
const char apn[]  = "www";
const char user[] = "";
const char ssid[] = "AndroidAP4";
const char pass[] = "asdasdasd";
int x = 0;

BlynkTimer sendData;

WidgetBridge bridge1(V100);

BLYNK_CONNECTED() {
  bridge1.setAuthToken("<auth token for device 2>"); // Place the AuthToken of the second hardware here
}

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);

  Blynk.begin(auth, ssid, pass);

  sendData.setInterval(500, sendCode);
}

void loop() {
  // put your main code here, to run repeatedly:
  Blynk.run();
  sendData.run();
}

void sendCode(){
  bool value = false;
  bridge1.digitalWrite(2, value);
  value = !value;

  if(x<1000)
    bridge1.virtualWrite(V99, x);
  x++;
  Serial.println(x);
}

Code for device 2 is:

#define BLYNK_PRINT Serial

#include <BlynkSimpleEsp32.h>

WidgetBridge bridge1(V100);

char auth[] = "<device 2 auth>";
const char apn[]  = "www";
const char user[] = "";
const char ssid[] = "AndroidAP4";
const char pass[] = "asdasdasd";
int p = 0;

BlynkTimer timer;

BLYNK_CONNECTED() {
  bridge1.setAuthToken("<device 1 auth>"); // Place the AuthToken of the second hardware here
}

BLYNK_WRITE(V99){
  p = param.asInt();  
}

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);

  pinMode(2, OUTPUT);
  digitalWrite(2, LOW);
  
  Blynk.begin(auth, ssid, pass);

  timer.setInterval(500, timerCode);
}

void loop() {
  // put your main code here, to run repeatedly:
  Blynk.run();
  timer.run();
}

void timerCode(){
  Blynk.virtualWrite(V13, p);
}

Since you are already sending timed data to the receiving side, then no need to have another timer, particularly since getting them synchronized will be rather difficult.

Do it this way instead…

BLYNK_WRITE(V99){
  Blynk.virtualWrite(V13, param.asInt());  
}

or

BLYNK_WRITE(V99){
  p = param.asInt(); 
  Blynk.virtualWrite(V13, p);  
}

i tried that change but unfortunately it didnt work. its alright though, i tested it on different project which are on different accounts. ill repeat the same for 2 projects within same account, and if that works, i can use that for my project. thank you so much for your help, it was quick and helpful :smiley:

I believe Bridge only works within the same account for security reasons… but I haven’t tested that.