Multiple relays on the new blynk format

Hoping to get some help with what most will think is really simple , ive been using Blynk Legacy for years and have quite a lot of devices set up in the house all just relay switching for lifgts etc.
So now with the Blynk IoT its not just a matter of connecting the board and adding widgets with my phone and I need to add virtual pins to switch the outputs.
Using an Arduino Uno ethernet board ,Ive set up a template ,added a device and a data stream using V1 to switch gpio #2 and that works great. So now I cant seem to get the code correct for using multiple relays with vitual pins . Seems there are a lot of different ways to maybe do it and have multiple relays working with virtual pins on my Cayenne dashboard , but the coding process is somehow different.
Im guessing there will be alot of Legacy users who are enjoying the reliable simplicty Legacy provides and will probaly be looking for the similar solutions , I know the many people ive hepled setting up systems in their homes will be expecting me to upgrade thiers.
Any help would be much appreciated.


#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "xxxxxxxxxxxxxxxxxxxxxxxxxxx"";

#define W5100_CS  10
#define SDCARD_CS 4

  int pinValue = param.asInt( );
void setup()
  // Debug console

  digitalWrite(SDCARD_CS, HIGH); // Deselect the SD card

  // You can also specify server:
  //Blynk.begin(auth, "", 80);
  //Blynk.begin(auth, IPAddress(192,168,1,100), 8080);
  // For more options, see Boards_Ethernet/Arduino_Ethernet_Manual example

void loop()

void loop()

@marto61 please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:


Thanks , sorry about that.

Not a good idea to mention the “C” word here :rofl:

If you want to add more relays then you simply need to add another pinMode declaration in void setup and additional BLYNK_WRUTE(vPin) handlers for your other datastreams.

If you want to control multiple relays from one virtual pin, or learn more about virtual pins in general, the read this…


Hi , took me a second to realise what the C word reference was , I will try as you mentioned , I thought I could just enter duplicate code with values to match the next data stream , but it kept switching Pin 2, I will do some reading and your correct , it would better long term to use the virtual pins and to keep using Blynk there no choice now anyway.
Thanks for help.