Transmitting Variables over RF I'm using the 3715 RF arduino modules and a hc-sr04, and i'm trying to send the distance i get from the ultrasonic over to the arduino with the rf recieving module but i get something like this: 

Instead of getting this:

Here are the code snippets for each arduino:

Arduino TX:

#include &lt;VirtualWire.h&gt;

const int led_pin = 11;
const int transmit_pin = 12;
const int receive_pin = 2;
const int transmit_en_pin = 3;
long distance;
long time1;
void setup()
{
   // Initialise the IO and ISR
   Serial.begin(9600);
   pinMode(9, OUTPUT); 
   pinMode(8, INPUT); 
   vw_set_tx_pin(transmit_pin);
   vw_set_rx_pin(receive_pin);
   vw_set_ptt_pin(transmit_en_pin);
   vw_set_ptt_inverted(true); // Required for DR3100
   vw_setup(2000);   // Bits per sec
}

byte count = 1;

void loop()
{
   digitalWrite(9,LOW); 
   delayMicroseconds(5);
   digitalWrite(9, HIGH); 
   delayMicroseconds(10);
   time1=pulseIn(8, HIGH); 
   distance= int(0.017*time1); 
   Serial.println("Distance ");
   Serial.println(distance);
   Serial.println(" cm");
   delay(1000);
   char msg[1] = {distance};

   msg[0] = count;
   digitalWrite(led_pin, HIGH); // Flash a light to show transmitting
   vw_send((uint8_t *)msg, 3);
   vw_wait_tx(); // Wait until the whole message is gone
   digitalWrite(led_pin, LOW);
   delay(1000);

}


Arduino RX:

#include &lt;VirtualWire.h&gt;

const int led_pin = 6;
const int transmit_pin = 12;
const int receive_pin = 11;
const int transmit_en_pin = 3;

void setup()
{
   delay(1000);
   Serial.begin(9600);  // Debugging only
   Serial.println("setup");

   // Initialise the IO and ISR
   vw_set_tx_pin(transmit_pin);
   vw_set_rx_pin(receive_pin);
   vw_set_ptt_pin(transmit_en_pin);
   vw_set_ptt_inverted(true); // Required for DR3100
   vw_setup(2000);  // 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, &amp;buflen)) // Non-blocking
   {
      int i;

      digitalWrite(led_pin, HIGH); // Flash a light to show received good message
      // Message with a good checksum received, print it.
      Serial.print("Got: ");

      for (i = 0; i &lt; buflen; i++)
      {
         Serial.print(buf[i], HEX);
         Serial.print(' ');
      }
      Serial.println();
      digitalWrite(led_pin, LOW);
   }
}


I'm open for pointers as i'm pretty much a noob at this, thank you very much for your help! :)
It looks like you're sending only one byte, but expecting to receive three.
In the TX sketch, char msg[1] = {distance}; declares an array of one char, assigns its zero-th element the value of distance. Then msg[0] = count; over-writes it with the value of count. vw_send((uint8_t *)msg, 3); tries to send three bytes but only the first one has been defined. The second and third bytes transmitted are outside of the 1-length array.

You need something more like:

vw_send(distance, sizeof(distance));


on the TX side, and:

long distance;
uint8_t count;

vw_get_message(distance, &amp;count));
Serial.println(distance);


on the RX side. You must receive the count into a variable but can ignore it, on the RX side; you know you'll be receiving a long; though good defensive coding would check the value anyway.