How to loop virtual pin

You should use the BLYNK_WRITE_DEFAULT() function. This only works if you don’t already have a BLYNK_WRITE(vPin) function for the virtual pins you’re using, so you’ll need to comment-out your existing BLYNK_WRITEs when testing.

This is how it works…

BLYNK_WRITE_DEFAULT()
{
  int widget_pin = request.pin;      // Which virtual pin triggered this BLYNK_WRITE_DEFAULT callback?
  int widget_value = param.asInt();  // Get the value from the virtual pin (0 = off, 1 = on)

// Your code in here to do the rest...

}

Pete.

2 Likes