How to repeatedly blink a LED using one virtual Button?

Hello,
I’m really newbie at Blynk community and i’m having some issues on my project. I’m making a demonstration of IOT using the Blynk app (school project), using the ESP8266 to read data from some sensors (up to now just DHT11, how you can see in the code) and control some leds and a buzzer. I have a button on the blynk app and when it is pressed , i want a phisically LED to repeatedly blink by determined period of time. I haven’t found anything in the forum that worked :frowning:
Here’s the code (ignore the comments in portuguese, the important is indicated).

#define BLYNK_PRINT Serial
#define DHTPIN 13                                 // Pino Digital do Sensor de Temperatura
#define DHTTYPE DHT11                             // Tipo do sensor (DHT 11)

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266_SSL.h>               // Definindo Bibliotecas
#include <DHT.h>

char auth[] = "authauthauthauthauth";             // Auth Token do app Blynk

char ssid[] = "HELP";                             // Credenciais WIFI (Nome,Senha)
char pass[] = "INeedSomebody";

DHT dht(DHTPIN, DHTTYPE);
BlynkTimer timer;

void sendSensor() {                               // Esta função envia as informções coletadas pelo
                                                  // sensor para o app Blynk
  float h = dht.readHumidity();
  float t = dht.readTemperature();                // No Blynk a função deve estar no modo "PUSH"

  if (isnan(h) || isnan(t)) {
    Serial.println("Erro na leitura do sensor!");
    return;
  }
  
  Blynk.virtualWrite(V5, h);                      // Umidade
  Blynk.virtualWrite(V6, t);                      // Temperatura

                                                  // Condicional do ar condicionado (LED) ligar:
  if (t>=35){                                     // "Se temperatura (t) for maior ou igual a 35, ligar LED"     
    digitalWrite (12, HIGH);
  }
  if (t<=28) {
    digitalWrite (12,LOW);                        // "Se a t for menor que 28, desligar LED (economia de energia)"
  }
}

///////////////////////////////////////////////////////////////////////////////

BLYNK_WRITE(V2)                              // Here's the part i'm having trouble with
{
  int pinValue = param.asInt(); 
  Serial.print("V2 value is: ");            // Virtual Button : V2
  Serial.println(pinValue);
  if(pinValue==1){
    digitalWrite (15, HIGH);                // LED pin : 15
    delay(100);
    digitalWrite (15, LOW);
    delay(100);
  }
//////////////////////////////////////////////////////////////////////////  


void setup() {                                    // Inicia o programa (baud rate: 9600)
                                       
  Serial.begin(9600);

  Blynk.begin(auth, ssid, pass);

  dht.begin();
                                        
  timer.setInterval(1000L, sendSensor);           // Envia as informações a cada 1 segundo
}

void loop() {                                     // "Blynk" rodando junto
  Blynk.run();
  timer.run();
}

I couldn’t format properly…
Sorry for my bad english and really thanks for any assistance and the patience.

I’ve tried using your code. It doesn’t worked for me, but maybe i’ve just used it wrong. Could you please help me with the application in the code? It would be awesome, I’m really needing help with this project ;-;

Here it is integrated into a bare bones Blynk Sketch… There should be enough commenting for you to figure it out from here.

#include <ESP8266WiFi.h>  // for ESP8266
#include <BlynkSimpleEsp8266.h>  // for ESP8266

BlynkTimer timer;

char auth[] = "xxxxxxxxxx";
char ssid[] = "xxxxxxxxxx";
char pass[] = "xxxxxxxxxx";
char server[] = "blynk-cloud.com";  // Blynk Cloud Server
int port = 8080;



void setup() {
  pinMode(2, OUTPUT);  // Setup GPIO2 - D4, the ESP8266's on-board LED, as an output pin

// Connect to your WiFi network, then to the Blynk Server
  WiFi.begin(ssid, pass);
  Blynk.config(auth, server, port);
  Blynk.connect();

// This dual nested timer routine will constantly blink both a Virtual LED and the onboard LED of an ESP8266 Dev Board
  timer.setInterval(1000L, []() {  // 1st Timed Lambda Function - Turn ON LED every second (repeating)
    Blynk.virtualWrite(V0, 255);  // Turn Virtual LED ON
    digitalWrite(2, LOW); // Turn ESP On-Board LED ON
    timer.setTimeout(500L, []() {  // 2nd Timed Lambda Function - Turn OFF LED 1/2 second later (once per loop)
      Blynk.virtualWrite(V0, 0);  // Turn Virtual LED OFF
      digitalWrite(2, HIGH); // Turn ESP On-Board LED ON
    });  // END 2nd Timer Function
  });  // END 1st Timer Function
}



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