Digital pin as virtual pin

How to use Digital pins such as D5 or D6 of nodemcu as virtual pins.I want to send data from pins D5 or D6 to the app.The high in the pinD5 will make the led flow in the app.The low in the pin D5 will make the led off.How to do this.?please help me with the code

Simply paste your code between ``` If you don’t format your code, your topic can be deleted by moderators.


void loop()

Blynk.virtualWrite(V5,digitalRead(D5)*255); //blynk led widget's value is between 0 and 255 and digitalRead values are 0 and 1...
1 Like

Check this example https://examples.blynk.cc/?board=NodeMCU&shield=ESP8266%20WiFi&example=Widgets%2FLED%2FLED_StatusOfButton