Need help virtual pins coding for led

in my project hear i am using 3 switch on D1, D2 ,D3 … BUT i need coding when d1 d2 d3 press separately three led will glow with them with virtual pins i am using the sketch hear plz tell me what changes have to do on this sketch

/*************************************************************
  Download latest Blynk library here:
    https://github.com/blynkkk/blynk-library/releases/latest

  Blynk is a platform with iOS and Android apps to control
  Arduino, Raspberry Pi and the likes over the Internet.
  You can easily build graphic interfaces for all your
  projects by simply dragging and dropping widgets.

    Downloads, docs, tutorials: http://www.blynk.cc
    Sketch generator:           http://examples.blynk.cc
    Blynk community:            http://community.blynk.cc
    Social networks:            http://www.fb.com/blynkapp
                                http://twitter.com/blynk_app

  Blynk library is licensed under MIT license
  This example code is in public domain.

 *************************************************************
  This example shows how to use Arduino Ethernet shield (W5100)
  to connect your project to Blynk.

  NOTE: Pins 10, 11, 12 and 13 are reserved for Ethernet module.
        DON'T use them in your sketch directly!

  WARNING: If you have an SD card, you may need to disable it
        by setting pin 4 to HIGH. Read more here:
        https://www.arduino.cc/en/Main/ArduinoEthernetShield

  Feel free to apply it to any other example. It's simple!
 *************************************************************/

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial


#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[] = "YourAuthToken";

#define W5100_CS  10
#define SDCARD_CS 4

void setup()
{
  // Debug console
  Serial.begin(9600);

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

  Blynk.begin(auth);
  // You can also specify server:
  //Blynk.begin(auth, "blynk-cloud.com", 8442);
  //Blynk.begin(auth, IPAddress(192,168,1,100), 8442);
  // For more options, see Boards_Ethernet/Arduino_Ethernet_Manual example
}

void loop()
{
  Blynk.run();
}

I wouldn’t call that a sketch, more of a template.

Study the docs for virtual pins and LED’s then come back with a real sketch but make sure it’s forum formatted not like the “sketch” you just posted.

basically i don’t have any idea about virtual pins i just want to switch on the led on virtual pins when digital pins is pressed so i just need any one example of same to understand the concept of virtual pins and how it’s work on led …

@rahul_likhar I have allocated your post to a category and formatted your code.

Study this https://examples.blynk.cc/?board=Arduino%20Uno&shield=Ethernet%20Shield%20W5100&example=Widgets%2FLED%2FLED_StatusOfButton and this http://docs.blynk.cc/#blynk-main-operations-virtual-pins

1 Like

The example led status of button
not working shows compilation error

shows msg.
exit status 1
‘BlynkTimer’ does not name a type

Sounds like you might have a old version of the library. Update it to 0.4.8

i checked my library it’s updated and i try another example but still shows same problem while compiling

https://examples.blynk.cc/?board=Arduino%20Nano&shield=ENC28J60&example=More%2FSync%2FSyncPhysicalButton

Can you paste a copy of the serial monitor output when booting your sketch?

@Gunner there will be no boot without compilation :slight_smile:

Yep… He had something prior… I wanted to see the library version… but I didn’t specify :blush:

Actually, that prior sketch should still be on the device then… thus it should boot.

Foggy brains… they have ideas, but forget to tell me the details :stuck_out_tongue:

@Rahul_Sarawagi @Gunner is right, 0.4.7 and prior didn’t have BlynkTimer in the main Blynk libraries.

How can you convince us that you have 0.4.8?

i found the problem its related with library i have update library but i found some file is missing from the library now every thing is ok thanks for u r help :grinning: