how can I send 4 integers wirelessly without the reciever mixing the numbers up

I send 4 integers with virtual wire. The numbers come out correctly on the receiver side but some times only 3 numbers come through and in the incorrect order for example if I send: 1 2 3 4

Then it sometimes comes out 2 3 4 1. Almost like it missed the first number. Someone recommended using ascii to notify the receiver when a byte starts and finishes but I do not understand what they meant. And they refused to elaborate further.

Did you read the stickies at the top of the forum? The ones that say "POST YOUR CODE"?

How are we supposed to answer questions about your code without seeing it?

I will post my code tomorow sorry. I am texting from my phone

See the technique in this demo about communicating between a PC and an Arduino. It uses start- and end-markers so the Arduino knows what is the start of the data and when it has all been received.

...R

Tx

#include <VirtualWire.h>
const byte LEDpin = 13;
const int bitsPerSecond = 1000;
const int N_VALUES = 4;
int values [N_VALUES] = {0, 25, 150, 275};

void setup()
{ 
  pinMode(LEDpin, OUTPUT);
  vw_setup(bitsPerSecond);
}

void loop()
{
  static unsigned long previousTime;
  unsigned long now = millis ();
  if (now - previousTime >= 1000)
  {
    digitalWrite(LEDpin, HIGH);
   
    vw_send((uint8_t *)values, sizeof(values));
    vw_wait_tx();
    
    digitalWrite(LEDpin, LOW);
    previousTime = now;
    for (int i = 0; i < N_VALUES; i++)
    {
      values [i]++;  
    }
  }  
}

Rx

#include <VirtualWire.h>
const byte LEDpin = 13;
const int bitsPerSecond = 1000;
const int N_VALUES = 4;

void setup()
{
  pinMode(LEDpin, OUTPUT);
  Serial.begin(115200);
  vw_setup(bitsPerSecond);
  vw_rx_start();
  Serial.println(F("Rx setup"));
}

void loop()
{
  int received [N_VALUES];
  uint8_t buflen = sizeof (received);

  if (vw_get_message((uint8_t*)&received, &buflen))           
  {
    digitalWrite(LEDpin, HIGH); 
    Serial.print(F("Got: "));
    for (int i = 0; i < N_VALUES; i++)
    {
      Serial.println(received [i]);
    }
    digitalWrite(LEDpin, LOW);
  }
}

And they refused to elaborate further.

I didn’t refuse to elaborate, I pointed out that I wasn’t your personal help-line - read the sig.