[SOLVED] getValue() gives only 0 in ESP8266

Press button from android Blynk, LED on ESP8266 responses correctly. But the .getValue() is only 0 result.

WidgetLED led5( ledPin );
void blynkLedWidget() 
{
  int Value = led5.getValue( ); 
  Serial.print( "value: "); // this line always print "0" ????????? 
  Serial.println( Value); 
  if (Value == 1 ) {
    led5.on();
    Serial.println("LEd on D5: ON");
  } else {
    led5.off();
    Serial.println("LED on D5: OFF");
  }
}


void setup()
{
  // Debug console
  Serial.begin(9600);
  pinMode( ledPin, OUTPUT);
  Blynk.begin(auth, ssid, pass);
  timer.setInterval( 3000L, blynkLedWidget);
}

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

shoud be 255 instead of 1. - http://docs.blynk.cc/#widgets-displays-led

It still does not give me the 255 , still get 0.
BTW, I used the digital pin in the button pin widget selection. Does it make any difference ?

BlynkTimer timer; 
int ledPin = 5; 

WidgetLED led5( ledPin );

Yes. WidgetLED is the abstraction over widget LED within the Application and not hardware.

Also you code is wrong. You need to change places of on() on and off(). We have ready example for that - https://github.com/blynkkk/blynk-library/blob/master/examples/Widgets/LED/LED_Blink/LED_Blink.ino

Still does not work.I get this result.

LEd on D5: ON
value: 0
LED on D5: OFF
value: 0
LEd on D5: ON
value: 0
LED on D5: OFF
value: 0

If one wants to use the digital pin in the button selection, How does one do to check the value on ESP side ?
BTW, on the button widget, I select the ‘switch’.

https://www.arduino.cc/en/Reference/DigitalRead