Getting LED in app to work

Hi,
Just new to blynk, its awesome. Trying to turn led widget on from NodeMCU (ESP8266). I can control the board from the app, but can’t seem to get the led widget to respond to the board.
I looked at the FAQ’s and one was similar but the link to the code example didn’t work.
I have a led widget set to V2
From the Arduino sketch I am using this simple code

void loop()
{
Blynk.run();

result=digitalRead(switchPin);
if(oldresult!=result)
{
if(result){
Blynk.virtualWrite(V2, LOW);
Serial.println(“Sending low”);
}
else {
Blynk.virtualWrite(V2, HIGH);
Serial.println(“Sending high”);
}

oldresult=result;
}

The led widget on the tablet doesn’t change.

Thanks for your help
Alastair

@al555bike have you tried a number between 0 and 255 rather than LOW and HIGH for the virtualWrite?

@Costas is right. You have to use 0 and 255 or use LEDWidget.on() and LEDWidget.off(). Please have a look into docs - http://docs.blynk.cc/#widgets-displays-led

Also you have to change a way you’re using virtualWrite. See example in above link.

Many thanks Dmitriy and Costas, that worked a treat.

Alastair