[SOLVED] Need help with the LED button

I am very new to Blynk and learning it very fast. It is simply amazing. However I am having problems with a very basic task. I have set up a pushbutton on (D2) of Photon and I am trying to get an LED to light on Blynk widget. I am using V4 on a value widget which changes from 1 to 0 as expected. However the LED widget connected to V1 does not light. Here are the program lines -
Blynk.virtualWrite(V1, state); // LED Widget
Blynk.virtualWrite(V4, state); // Value Widget
BTW state is an integer .

Does the LED widget require a bool variable to turn on and off ? I believe I have tried that already.

I would appreciate some feedback since this simple problem is now driving me crazy. Thanks

If you are passing an int to the LED, then the range is 0-255 (255 being full brightness).
Alternatively you can use LOW/HIGH to specify a fully off/on state.

A big shout out and huge thank you for your response. I think that should do it ! I have been thinking digitally and should’ve figured it out myself. Thanks again and cheers…

1 Like

@trinican2 I believe you want to start out with something like this…

WidgetLED led3(V3);
led3.on();
led3.off();

@Jamin is right you can also set a level though I’ve never used that
Look in the examples under Widgets/LED

Funnily enough, I too had the exact same problem only a few months ago! So just passing the knowledge forward! :smiley:

I always have issues calling the WidgetLED so never use it. I find it slows down the ESP8266 NodeMCU too much.

Ha! When starting out with Arduino and Blynk I could not get
Blynk.virtualWrite() to work with LED Widgets and gave up with it. Just tried again and now they work fine. Who knows what my problem was…