[SOLVED] Can't get LED widget to work

I write 0 or 255 to a virtual pin, and when I use a ValueDisplay widget I can visualize the correct value.
But when I connect an LED instead of ValueDisplay it never lights.

This happens on an ESP32 running Mongoose OS, but I also tried it on a PC with the js example. In this case writing is performed in this way:

v9.on('read', function() {
	if ((new Date().getSeconds())>30)

Any clue? Thanks.

As per the Documentation:


The correct ON/OFF commands are:


And for varying the “intensity” they are:

led9.setValue(127); //set brightness of LED to 50%.

Also you need to define the widget at the beginning of your sketch:

WidgetLED led9(Vx); //register to virtual pin x

As for Mongoose OS and JS, there are probably slight syntax differences, but basic commands should be similar, or just use the blynk.virtualWrite() command

blynk.virtualWrite(x, 1023);  // Turn Vx Widget LED ON

Thank you, it works now, at least the JS version.
But the problem was not in the write command, VirtualPin.write, led.setValue, blynk.virtualWrite does the same thing and are all OK.

What I was missing is that the Led widget does not asks for a value like most other visualizing widgets. It lacks the “Reading Rate” setting.
So the value should be pushed to it, I did it this way:

var LedStatus = 0;
var v9 = new blynk.VirtualPin(9);

function LedToggle () {
	if (LedStatus)
		LedStatus = 0;
		LedStatus = 255;
	//blynk.virtualWrite(9, LedStatus);
setInterval(LedToggle, 1000);

Thanks again.


Oh, sorry, I thought you HAD it working with JS and Mongoose OS… but were trying to get it to work the way the Blynk documentation was written… for C++

Correct, it acts just like a real LED; ON, OFF and varying intensities in between… no reading rates necessary as it is not technically a display for “alphanumeric data”.

Incidentally, I find that the intensity range for the LED Widget with JS requires 0-1023, not 0-255. Are you getting the LED to show full “intensity” with only 255?

It just uses the lower 8 bits, Setting 256 switches the LED off.

Strange… on my project (running on an RPi), 255 is a barely visible, but visible nevertheless, intensity of the chosen LED colour.

I use a slider set from 0-1023 for adjusting the LED range.

I’m quite sure that the difference is in the phone app. I’m using 2.14.6 on Android. It was updated a few minutes ago.

Same App version here, and latest Local Server, but RPi library is still 0.4.7 as that is the latest I can seem to get with sudo npm install blynk-library -g so some slider jitters, but I get the full range of 0-1023 on the LED (admittedly it is difficult to see “each” graduation, depending on App display).

EDIT - You are correct!.. the jumpy slider makes is hard for fine resolution, so I was extrapolating based on the closest to 255 I could get (usually just a few digits over, thus dim), but with a range of 0-1023, I am actually getting 4 independent Off-Full intensity ranges with the slider, go fig :stuck_out_tongue: So I switched my project vLEDs to 0-255 ranges all around.

So anyhow, is this topic solved, or where you still needing assistance?

I’m fine, thanks, working on ESP32 again.