[SOLVED] Blynk Virtual LED locks up Particle Photon

I have a Particle Photon that I am interfacing to Blynk. I can get buttons to work fine with their digital pins. I can’t seem to get the virtual pins with the Blynk LEDs to work.
I have a sample program that will blink the on-board LED when I assert a Blynk button on digital pin (0).
If I run the same program with the Blynk LED gadget, the Photon locks up as soon as the led1.on (also tried Virtual write) code is hit.
It seems that the #included Blynk library puts the photon out in the weeds.

Here is my code. Any thoughts on what I have wrong?

#include “blynk/blynk.h”
#include “SparkIntervalTimer/SparkIntervalTimer.h”

char auth[] = “adcf6c1bf99046969962862e273ad702”;
WidgetLED led1(V0); //register to virtual pin 0

// Create IntervalTimer object
IntervalTimer myTimer2;

// Pre-declare ISR callback functions
void blinkLED(void);

const uint8_t ledPin2 = D7; // LED for Interval Timer
int button = D0; // Button input pin (3.3v input)

void setup(void) {
Serial.begin(9600);
Blynk.begin(auth);

pinMode(D7, OUTPUT);
pinMode(button, INPUT_PULLDOWN);

myTimer2.begin(blinkLED, 5000, hmSec, TIMER4); // 5000 5 Seconds
}

void blinkLED(void) {
// digitalWrite(ledPin2,!digitalRead(ledPin2));

if (digitalRead(button) == HIGH) {
// led1.on();
digitalWrite(ledPin2,!digitalRead(ledPin2));

    int state = !digitalRead(0);
    Blynk.virtualWrite(V0, state);

} else {
// led1.off();
}
}

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

}

Don’t know anything about Particle Photon’s and I haven’t checked your sketch but I do know the Blynk guys have coded virtual pins different to digital pins. Locked up my Arduino with ESP regularly. I had to ditch all the virtual pins and use digital pins which is a real waste of resources.

Just this evening I had to code around the virtual pins I had tied to a couple of timer widgets.

More details highlighting the ‘issue’ are at Blynk Libraries

@vshymanskyy, could you please check

@Pavel and @vshymanskyy I am guessing it is the extra features that are contained in virtual pins that are crashing our systems.

It well may be that this library runs your code in the interrupt context, and it may be not safe to operate WiFi (send commands) in this context.

That was it! I switched to the polled timer and it now works fine.
Thanks for the help.