Are the virtual pins for two devices unique or the same?

Hi newbie here. I’m currently (slowly) learning my self into Blynk, C++, ESP’s and Arduino’s. I’m currently working on a bridge between two ESP’s using this topic. One of the thing I noticed is that this person does:
bridge1.virtualWrite(V5, 1000);
Blynk.virtualWrite(V5, h);
Now both are connected to the same Blynk app. This raises a couple of questions:

  1. why is he using ‘1000’ and is this the same as ‘HIGH’ ??
  2. are the Virtual pins unique for each device (as this code presumes) or will this run into potential errors? Basically he write ‘1000’ to V5 on ESP2 and h (humidity) to V5 on ESP1. I was under the impression that the VP’s were stored on the Blynk server and the same for one application (apparently a wrong assumption, but I want to check).
  3. how many VP’s are there actually?
  4. He doesn’t set:
    pinMode(2, OUTPUT);
    in the void setup(). Is this not required for Blynk?

Thank you!!

1 Like
  1. Im not sure but if it works i guess 1000 does the same as high, but i would still use HIGH, never seen 1000 being used until now.
    2.each device has its own V pins so he can write data to v5 of device 1 and send data via bridge to the v5 pin of the second device.
  2. Im pretty sure there is no limit but blynk is capped at 127.
  3. i used to never put the pinMode in my code but for the esp32 for example i had to otherwise the pins would not do anything. and when i didn’t do it on the esp8266 every time the power went off i had to pull the pins high manually because my vpins that were connected with them would not work. ( This might sound confusing but the short answer is just put it in your code, it can’t hurt).
    Im pretty sure about my answeres but if i got anything wrong im sure someone will step in and correct me :slight_smile:
1 Like

thanks for the clear and quick answers. I had found the answer to 3 already, which is waaaay at the bottom of the Blynk documentation. They’re capped at 32 but you can change this by
#define BLYNK_USE_128_VPINS
its not entirely clear whether you can just put this on the top of your code or whether you need to actually change one of the header files.

You need more then 32 ? What you planning ? :stuck_out_tongue:

This mostly defensive security measure :slight_smile:.

You can do both.

1 Like

As long as each device has its own identifying AUTH code (even if in same project), then yes they should be unique to each device and possible to have a V5 on both devices, each doing different things.

I have a bidirectional Bridge example that might help with your further understanding…

Thank you for all the quick and good input.

That’s not quite entirely an unfair question: I have 4 floors with in total 11 heat zones. I would like to check the T for each zone (11) operate the water pumps if required (4) and check the in/out temp of the heating (22). Thats in total 36 ‘elements’ I need to check. Beyond that, to keep things a bit comprehensible I’d prefer to ‘code’ the sensors e.g.
zones based on number and floor. e.g. 2nd floor 1st zone = V21, 4th floor 2 zone = V42 (which is the highest V-pin number I’d like to set).

The fact that each VP is unique per device is actually a bit annoying for me as I’d like to accumulate all sensor input at one point and regulate from there on. If you’re interested, this is our situation currently:

The valves are directly operated by the thermostats (220V relay).

I want to remotely control each setting and EVERY zone (considering to add valves to the two open zones as well), additionally I want to check whether the zones are actually working. So e.g. if T1 says ‘go’ then V1 opens and then Zone 1 gets heated. I’d like to check whether thats actually happening (initially by checking the current, but its too low, then by voltage, but too dangerous, then by waterflow, but too expensive, so finally by checking the dT between outgoing and incomming heating tube.)

If you need snippets for your project i recommend the Sketch builder