Define: [quote=“alyaa_sheir, post:1, topic:10375”]
blink a led with virtual pin
[/quote]
i.e. Blink when holding button; Blink when toggling button (ON); Blink when giving the button a nasty look; Don’t ask questions, JUST BLINK DARN IT… etc.
EDIT: OK, normally the idea is to help you to learn how to get these answers yourself, not do it for you… so I will start off with the obligatory RTM - http://docs.blynk.cc/#blynk-firmware-virtual-pins-control, but I understand how lacking of clear examples those DOCs seem to be…
…And I was bored
So here is how I just learned to make a “blink LED while button held down” function. Probably much better ways, but hey, I’m just learning too Feel free to use this and tweek it to your purpose.
BLYNK_WRITE(V1) // Run this funtion when V1 button presed.
{
int pinValue = param.asInt(); // Get status of V1.
if (pinValue == 1) { // If status of V1 is 1 then do stuff in if().
digitalWrite(2, HIGH); // Turn on LED.
delay(20); // Wait 10 millis but remember you are holding up the sketch.
digitalWrite(2, LOW); // Turn off LED.
Blynk.run(); // Return to rest of Blynk operations, in-between waiting for this loop to repeat or quit.
int pinValue = 0; // Set V1 status to 0 to quit... unless button is still pushed (as per below)
Blynk.syncVirtual(V1); // ...Then force BLYNK_WRITE(V1) function check V1 button status to determine if repeating or quitting loop.
}
}
Thus getting the function loop to re-check the button action, while still running the loop. Otherwise one had to keep pressing the button to get a short blink… or (depending on method of loop) even getting stuck in the function loop until reset.