How to turn on widget LEDs


I was wondering how to turn on the LED widget in the blynk app.
I am using Arduino UNO to Android, and i i’ve tried these configurations:

WidgetLED led8(8);


Blynk.virtualWrite(8, 1/HIGH/1023)

If I put a gauge on Virtual pin 8, and use method 2, I get a response, but if i put a led widget, it doesn’t react to anything. So how do i do?

I know it’s a very basic question, but i simply couldn’t find documentation on it anywhere. Either i missed something, or you don’t really have good documentation on anything, which is getting pretty annoying, as it takes a lot of time to figure out how to do basic things.


Hi, have you tried this example?

Yes. Sorry, i wrote the code wrong in the example, but that’s the one i tried. I will edit that.
I tried again, and it seems my problem lies with the fact that i put the led.on() in the void setup() section.
Putting it anywhere else made it work for me.

Thank you very much for the quick reply, @Dmitriy!

I really don’t wan’t to sound like a pessimistic jerk, and I know you’ve just started this whole thing, but I really think that you should make some better “getting started” pages.
I know you have these codes, but i think it’s hard too understand them without a lot of comments, and in generally it took me a lot of time just to figure out, that that was your guidance pages.
Basicly, the code is good to show what you can use the LEDs for, but too complicated to help you understand how to just simply make it work in your own project.

If i were you, i would make a very clear startup page, that shows you exactly how to run Blynk on the specified board (the #include library and, and then a quick summary of the basic functions the library include. They don’t need to be comprehensive or in great detail, as long as they point you in the right direction, and you can search for eg. “How to turn on widget LED” and then get a page telling you to use the functions WidgetLED and led.setValue, and then maybe a very short piece of code, where you just turn on one LED.

If you’ve had that, getting as far as i’m right now would’nt have taken me 12 hours, but probably more like 2-3 hours.

At least that’s my opinion.

But helppage or not, this is still awesome, and i’m looking forward to implementing this in my project!

Thank you again!

@Anton_Juul, thank you for your feedback! I agree that currently we have some problems with documentation. We will fix it.

1 Like

HI Guys, I have the same problem . . . but the link provided above is not available

As it is a year old post, that can happen :slight_smile:

Here is the link to the DOC page - specifically the LED widget information.

There are also examples in the, well, examples page :slight_smile:

Did you have any specific issue with some code?

Can you edit your last post please. Put the three ``` keys (the key usually to the left of your 1 key) before and after your code so we can see it better.

Also, post the entire code (just xxxxx out your auth key) so we can better evaluate any syntax issues.

Thnx again,

Thnx for quick response - I’m using LED_StatusOfButton.ino example.

I have previously had a working sketch to blink on an LED on my Uno (via ESP8266). This works well.

I have created a new widget, it connect OK and does not give error message so widget and ESP8266 are online and talking.

I connect a jumper cable between pin 7 and GND, then +5V (to simulate a switch), but the led on the widget does not turn on.

This is the code I cut/paste into my working ESP8266 sketch:

#include <Blynk.h>

#include <ESP8266_Lib.h>

#include <ESP8266_Lib.h>

 * 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:
 *   Blynk community:  
 *   Social networks:  
 * Blynk library is licensed under MIT license
 * This example code is in public domain.
 * This example shows how to use ESP8266 Shield (with AT commands)
 * to connect your project to Blynk.
 *   It's rather tricky to get it working, please read this article:
 * Change WiFi ssid, pass, and Blynk auth token to run :)
 * Feel free to apply it to any other example. It's simple!

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>
#include <SimpleTimer.h>

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

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

// Hardware Serial on Mega, Leonardo, Micro...
#define EspSerial Serial

// or Software Serial on Uno, Nano...
// #include <SoftwareSerial.h>
// SoftwareSerial EspSerial(2, 3); // RX, TX

// Your ESP8266 baud rate:
#define ESP8266_BAUD 115200

ESP8266 wifi(&EspSerial);

// Select your pin with physical button
const int btnPin = 7;

WidgetLED led3(V3);

SimpleTimer timer;

// V3 LED Widget represents the physical button state
boolean btnState = false;
void buttonLedWidget()
  // Read button
  boolean isPressed = (digitalRead(btnPin) == LOW);

  // If state has changed...
  if (isPressed != btnState) {
    if (isPressed) {
    } else {;
    btnState = isPressed;

void setup()
  // Set console baud rate
  // Set ESP8266 baud rate

  Blynk.begin(auth, wifi, ssid, pass);

  // Setup physical button pin (active low)
  pinMode(btnPin, INPUT_PULLUP);

  timer.setInterval(500L, buttonLedWidget);

void loop()



You will notice the difference in your preview window. Correct key, but do not use shift. And just edit the last post with the code in it, no need to create another one…gets too cluttered.

OK - sorry - just been playing with the pins - physical pin 7 on my Uno - virtual pin V3 on the widget - connecting physical pin 7 to GND now turns on the LED Widget.

Thankyou for your patience, very much appreciated. I’ve also learnt some more forum etiquette!


Sounds good! :smiley: … now perhaps practice that etiquette by editing your last code posts (the latent OCD in me is acting up :stuck_out_tongue: )

1 Like

No Problem. Just to finalise this in VERY simple terms for beginners like me . . .

  1. The code shows physical pin 7, I had correctly connected my physical switch to pin 7 on the Arduino Uno.
  2. I had then set the widget LED pin to virtual 7 - this did not work, wrong pin.
  3. Looking at the sketch I noticed the “WidgetLED led3(V3);” line, when I changed the widget pin assignment to pin V3 the widget worked.

Onwards and upwards!

The link you mentioned does not exist

Almost 3 years old.
Same details are in your phone, on GitHub, on this site, on sketch builder, in the IDE etc, take your pick.

1 Like