Project keeps randomly crashing

I’ve got 2 Arduino’s running. One transmits 4 numbers every minute via a 433MHZ wireless module at 1200 baud (Using VirtualWire)

The other receives these numbers and sends them to the PC via a serial port. The numbers transmitted to computer are in the format “*,no1, no2, no3, no4,#”

Everything is so far working great - the problem I’ve found is that the receiver randomly stops working (most of the time after an hour)

If I reset the receiver it starts working again.

I’ve posted my code below, does anything stand out which could cause a problem. Hopefully I’m missing something simple as I can’t understand why the code stops. It seems pretty simple enough.

#include <VirtualWire.h>

#define rxPin 4
#define txPin 5

int numbers[4];

void setup()
 vw_setup(1200); // Bits per sec
 vw_rx_start(); // Start the receiver PLL running


void loop()
  uint8_t buf[VW_MAX_MESSAGE_LEN];
  uint8_t buflen = VW_MAX_MESSAGE_LEN;

  if (vw_get_message(buf, &buflen)) // check to see if anything has been received
    Serial.print("*");          //Start Bit
    for (int i = 0; i < 4; i++)
      numbers[i] = word(buf[i*2+1], buf[i*2]);
      Serial.print(numbers[i], DEC);
   Serial.print("#");          //Stop Bit

if (vw_get_message(buf, &buflen)) // check to see if anything has been received

OK you check if anything has been received but you don't check how much -> buflen ???

=> add serial.print(buflen, DEC); to check if there is the problem.

Thanks for the tip - I’ll have a look at that.