I need help with led blinking while it is on (app)and led off when off on blynk app application
Please provide your code
I think he wants someone to write his code
This might work… well… the opposite way (Blinking LED when App disconnected)… I misinterpreted the OP question.
// Run if App disconnects
BLYNK_APP_DISCONNECTED() {
// This dual nested timer routine will constantly blink the onboard LED of an ESP8266 Dev Board
timer.setInterval(2000L, []() { // Start 1st Timed Lambda Function - Turn ON LED every 2 seconds (repeating)
timer.setTimeout(1000L, []() { // Start 2nd Timed Lambda Function - Turn OFF LED 1 second later (once per loop)
digitalWrite(2, HIGH); // Turn ESP On-Board LED OFF
}); // END 2nd Timer Function
digitalWrite(2, LOW); // Turn ESP On-Board LED ON
}); // END 1st Timer Function
}
}
Perhaps try in the BLYNK_CONNECTED() function
Documentation for Blynk, the most popular IoT platform for businesses.
Or use the same methods as reconnection routines and such with if() else()
functions
void loop() {
timer.run();
if (Blynk.connected()) { // If connected run as normal
Blynk.run();
LEDflashFlag == 1;
} else {
LEDflashFlag == 0;
}
LEDflashFunc();
}
And then make a non-blocking LED flashing routine that only runs when the flag = 1