VirtualWire.h arduino send

I use VirtualWire.h library.I want to send muiltiple sends. This example send a message every 400ms:

void loop()
{
  const char *msg = "hello";
  vw_send((uint8_t *)msg, strlen(msg));  // Send 'hello' every 400ms.
  delay(400);

}

I want to send de same message,two times when a receive 1 value. Code:

void receive_RF()
{

  if(vw_get_message(buf, &buflen)) 
  {
      if(buf[0]==1){
        Serial.println("Where");
        buf1[0]=1;
        buf1[1]=1;
        vw_send((uint8_t *)buf1, 2);
        delay(400);
        vw_send((uint8_t *)buf1, 2);
        
  }
 }
}

But if i try this,system block and nothing.When i delete the second send it works.Why?Any solution?

It might help if you included the rest of the code. I don't see the declarations of buf or buf1.

#include <VirtualWire.h>
uint8_t buf[VW_MAX_MESSAGE_LEN];
uint8_t buflen = VW_MAX_MESSAGE_LEN;
char buf1[2];

void setup()
{
  
  attachInterrupt(0,receive_RF,CHANGE);
  Serial.begin(9600);
  vw_set_rx_pin(2);
  vw_set_tx_pin(4);  
  vw_setup(2000); 
  vw_rx_start(); 

}

void loop(){

}

void receive_RF()
{

  if(vw_get_message(buf, &buflen)) 
  {
      if(buf[0]==1){
        Serial.println("Where");
        buf1[0]=1;
        buf1[1]=1;
        vw_send((uint8_t *)buf1, 2);
        delay(400);
        vw_send((uint8_t *)buf1, 2);
        
  }
} 

}

You can’t use delay() in an ISR. While the ISR is executing the interrupts are disabled so the millisecond clock doesn’t run. You also shouldn’t use Serial because if the buffer fills up the sketch will freeze. Try this:

#include <VirtualWire.h>
uint8_t buf[VW_MAX_MESSAGE_LEN];
uint8_t buflen = VW_MAX_MESSAGE_LEN;
char buf1[2];

void setup()
{
  Serial.begin(9600);
  vw_set_rx_pin(2);
  vw_set_tx_pin(4);  
  vw_setup(2000); 
  vw_rx_start(); 
}

void loop(){
    if(vw_get_message(buf, &buflen)) 
  {
    if(buf[0]==1){
      Serial.println("Where");
      buf1[0]=1;
      buf1[1]=1;
      vw_send((uint8_t *)buf1, 2);
      delay(400);
      vw_send((uint8_t *)buf1, 2);

    }
  } 
}

Thank you for the reply.
It woks like you wrote.I understand that delay dont work in ISR but why the serial dont work too?
If I do this:

#include <VirtualWire.h>
uint8_t buf[VW_MAX_MESSAGE_LEN];
uint8_t buflen = VW_MAX_MESSAGE_LEN;
char buf2[2];

void setup()
{
  
  attachInterrupt(0,receive_RF,CHANGE);

  vw_set_rx_pin(2);
  vw_set_tx_pin(4);  
  vw_setup(2000); 
  vw_rx_start(); 

}

void loop(){

}

void receive_RF()
{

  if(vw_get_message(buf, &buflen)) 
  {
      if(buf[0]==1){
        buf1[0]=1;
        buf1[1]=1;
        vw_send((uint8_t *)buf1, 2);
        vw_send((uint8_t *)buf1, 2);
        
  }
} 

}

Without the delay and serial print,it dont work.Why?can you explain?I want to understand.

It is possible that the VirtualWire library also uses interrupts to move serial characters out of buffers. If the buffer is full it is natural to wait for an interrupt to come along an move a character out of the buffer. If the interrupts are disabled the interrupt will never happen and your code will lock.

You have the VirtualWire sources so you an check them to see if they use interrupts or not.

Thank you for your explanation, i understand.