Data pin4 > Virtual pin

I would like to assign D4 pin to Virtual # on my ESP8266 module (Wemos D1 mini) to turn on Led with PB widget. Any help would be great!

I can use this code to turn on off Led using D4 (need to change to virtual pin#)

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

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

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "xxxx";
char pass[] = "xxxx";

void setup()
{
  Serial.begin(9600);
  Blynk.begin(auth, ssid, pass);
}

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

Please do not post unformatted code. Read here: [README] Welcome to Blynk Community!

You can find documentation about virtual pins here:
http://docs.blynk.cc/#blynk-main-operations-virtual-pins

Also example sketches are often very useful: http://examples.blynk.cc/
Check the Getting Started -> Get Data example for simple virtual pin usage

1 Like