Using > 127 Virtual Pins in sketch

Virtual pins out of 0-127 range are be supported only via BLYNK_WRITE_DEFAULT() / BLYNK_READ_DEFAULT() API
https://docs.blynk.cc/#blynk-firmware-blynktimer-blynk_write_default

There are no plans to support more than 128 pins on fw level via “easy API”.

The docs are updated

1 Like

I never figured out how to use more than one of those functions at a time anyhow :blush:

And while this is @mars Topic… now I am curious… what does this have to do with when the official use of up to 255 virtual pins (using the normal functions) begin? Next Library release?

1 Like

I had to hunt for this :stuck_out_tongue: So for anyone curious…

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");
1 Like

fine ! :wink:
@Gunner I use

Blynk.virtualWrite(128, "abc");

@Gunner no the BLYNK_WRITE() syntax will not be supported for pins > 127.

Ah, OK… I think that is where the assumptions started… that it was just code as normal, but now with MOWR vPins :stuck_out_tongue:

thanks for that.

Just curious, is there a particular reason why

BLYNK_WRITE

is not supporting for vPIN > 127 ?

I tried

BLYNK_WRITE(V228) {

without

#define BLYNK_USE_256_VPINS

that runs too

interesting - does that seem to be in contrary to @vshymanskyy advice a couple of threads back ?

I don’t know, it works for me as described
maybe @Gunner tell us more ?

Ha… I don’t know… I am all bossy, not all knowing (shush, don’t tell anyone ) :stuck_out_tongue_winking_eye: I thought that this was a system wide expansion of vPins for normal use, not a partial update that has strange use cases and rules. But then even with my MEGA testbench, I never exceed 80 consecutive vPins anyhow so I never looked into it until I saw this topic.

1 Like

No it does not work :wink: The fact that it compiles doesn’t mean it works.

1 Like

@mars it would increase memory usage.

1 Like

yes , it does not work, nothing is displayed on my label widget , really bad :wink:

Hello @vshymanskyy @Dmitry I am just curious if this functionality will be released on the next Blynk Library maybe V0.5.5?

Please read my comments above. Especially:

The BLYNK_WRITE_DEFAULT() function handle virtual write for all pins > 127, this is a small example to manage pins 181 and 190:

BLYNK_WRITE_DEFAULT()
{
  int pin = request.pin;      // Which pin has trigger write
  int value = param.asInt();  // Use param as usual.

  //only for debug
  Serial.print("virtual write pin: ");
  Serial.print(pin);
  Serial.print(" value: ");
  Serial.println(value);

  //handle pins actions
  switch(pin){
    case 181:
      //your custom code for pin 181
      Serial.println("TODO 181");
      break;
      
    case 190:
      //your custom code for pin 190
      Serial.println("TODO 190");
      break;
   }
}

Best Regards

4 Likes