Virtual Pin How many can you use?

Hello,

I am building and LED light controller the needs a lot of buttons. All going ok so far but…

How many Virtual pins can you have? The App shows up to 255 but the code BLYNK_WRITE only seems to go up to 127.

I am using the latest library 1.0.1

@Rollmop hello, 255. You can use just a number 128 after 127. It should work.

@vshymanskyy could you please update the doc? It’s not clear, also in old Blynk we had a property to extend the number to 255 pins. Is that still uesd?

1 Like

I am using old Blynk. So you say there should be 255?
How do I access the other 128 then?

1 Like

Capture

You have to use BLYNK_WRITE_DEFAULT() for pins over 127 (it can be used for pins below 0-127 as well, if that would help with your code structure.

BLYNK_WRITE_DEFAULT()

Redefines the handler for all pins that are not covered by custom BLYNK_WRITE functions.

BLYNK_WRITE_DEFAULT()
{
  int pin = request.pin;      // Which exactly pin is handled?
  int value = param.asInt();  // Use param as usual.

When you’re using Blynk.virtualWrite to pins over 127 then you can only use the pin number, without the preceding “V”. Once again, the “V” is optional for any Blynk.virtualWrite command, so you can tidy-up your code by never using the “V” prefix for any pin if you wish.

Note: For virtual pins with numbers > 127, the V128 syntax is not available.
Please use plain virtual pin number, for example:

Blynk.virtualWrite(128, "abc");

Pete.