Bridge Vpin explanations

FYI, I figured most of this bridge stuff out via trial and error… often quicker the waiting for answers :stuck_out_tongue_winking_eye:

An assigned bridge is referencing a single Auth, AKA a specific device, so sending to different vPins on that same device is all you need to do…

If you want to send data and/or control multiple receiving devices (eg. device A, B & C) then you have to define multiple bridges, one for each.

WidgetBridge bridgeA(vPin1);  // Use free unused vPins from sending device
WidgetBridge bridgeB(vPin2);  // Each define needs its own vPin
WidgetBridge bridgeC(vPin3);  // These vPins have no association with the receiving devices.
BLYNK_CONNECTED() {
  bridgeA.setAuthToken("aaaaaaaaaa"); // Token of the receiving hardware A
  bridgeB.setAuthToken("bbbbbbbbbb"); // Token of the receiving hardware B
  bridgeC.setAuthToken("cccccccccc"); // Token of the receiving hardware C
}
bridgeA.virtualWrite(V0, ValueForV0);  // Sending value to receiving device A vPin
bridgeB.virtualWrite(V1, ValueForV1);  // Sending value to receiving device B vPin
bridgeC.virtualWrite(V2, ValueForV2);  // Sending value to receiving device C vPin

BTW, you can assign any variable name to a bridge if that makes it easier to manage in your code

WidgetBridge BoilerDevice(vPin1); 
WidgetBridge PumpDevice(vPin2);
WidgetBridge LightingDevice(vPin3);
1 Like