Virtual Wire acted out weirdly

Hi, I have coded this so far for the transmitter and the receiver of the rf module.

This is the code for the transmitter:

#include <VirtualWire.h>

int potUp = A0;
int potForward = A1;
int potSide = A2;
int potGForward = A3;
int potGSide =A4;


void setup() {
  // put your setup code here, to run once:

vw_setup(2000);
vw_set_tx_pin(0);
pinMode(potUp, INPUT);
pinMode(potForward, INPUT);
pinMode(potSide, INPUT);
pinMode(potGForward, INPUT);
pinMode(potGSide, INPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
int valUp = map (analogRead(potUp), 0, 1023, 0, 9);
int valForward = map (analogRead(potForward), 0, 1023, 0, 9);
int valSide = map (analogRead(potSide), 0, 1023, 0, 9);
int valGForward = map (analogRead(potGForward), 0, 1023, 0, 9);
int valGSide = map (analogRead(potGSide), 0, 1023, 0, 9);

vw_send((uint8_t *)"$", 1);
vw_wait_tx();
vw_send((uint8_t *)valUp, 1);
vw_wait_tx();
vw_send((uint8_t *)valForward, 1);
vw_wait_tx();
vw_send((uint8_t *)valSide, 1);
vw_wait_tx();
vw_send((uint8_t *)valGForward, 1);
vw_wait_tx();
vw_send((uint8_t *)valGSide, 1);
vw_wait_tx();

This is the code for the receiver:

#include <VirtualWire.h>

void setup() {
  // put your setup code here, to run once:
vw_setup(2000);
vw_set_rx_pin(1);
vw_rx_start();
Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
uint8_t buflen = VW_MAX_MESSAGE_LEN;
uint8_t buf[buflen];

vw_get_message(buf, &buflen);

Serial.print("%");
Serial.println(buflen);
Serial.print(":");
for (int i=0; i<buflen; i++)
{
  Serial.print(buf[i]);
}
}

For this, if somethings that look like this is put into the transmitter:
$23456

For this, I expect the Serial to return somethings that look like this for the receiver:
%1
:2
%1
:3
%1
:4
%1
:5
%1
:6

Instead it gave me this on the receiver port:
%30
:8246018172148222119903380066431255255203003712864038250%30
:8246018172148222119903380066431255255203003712864038250%30
:8246018172148222119903380066431255255203003712864038250%30
:8246018172148222119903380066431255255203003712864038250%30
:8246018172148222119903380066431255255203003712864038250%30
:8246018172148222119903380066431255255203003712864038250%30
:8246018172148222119903380066431255255203003712864038250%30
:8246018172148222119903380066431255255203003712864038250%30
:8246018172148222119903380066431255255203003712864038250%30
:8246018172148222119903380066431255255203003712864038250%30
:8246018172148222119903380066431255255203003712864038250%30
:8246018172148222119903380066431255255203003712864038250%30
:8246018172148222119903380066431255255203003712864038250%30
:8246018172148222119903380066431255255203003712864038250%30
:8246018172148222119903380066431255255203003712864038250%30
:8246018172148222119903380066431255255203003712864038250%30
:8246018172148222119903380066431255255203003712864038250%30
:82460181721482228242033801931199821284803030643000176%30
:82460181721482228242033801931199821284803030643000176%30
:82460181721482228242033801931199821284803030643000176%30
:82460181721482228242033801931199821284803030643000176%30
:82460181721482228242033801931199821284803030643000176%30
:82460181721482228242033801931199821284803030643000176%30
:82460181721482228242033801931199821284803030643000176%30
:82460181721482228242033801931199821284803030643000176%30
:82460181721482228242033801931199821284803030643000176%30
:8246018172148222842110338019311990085403030663000%30
:8246018172148222842110338019311990085403030663000%30

At least, this is absolutely wrong as the length of the buf is already 30, which is absolutely wrong.

Please, tell me if this is the code problems, or the signal noise problems.

IF THIS THS BECAUSE OF NOISE, PLEASE TELL ME HOW TO FIX IT.

Your caps lock key is stuck, which is viewed as unpleasant "forum noise".

You are not sending the data correctly, or receiving it correctly. To send a two byte integer variable use

int valGForward=1234;
vw_send((uint8_t *)&valGForward, 2);

To receive a two byte integer variable, use

uint8_t buflen = 2;
int data=0;
vw_get_message((uint8_t *)&data, &buflen); //check that buflen==2 afterwards
for (int i=0; i<buflen; i++)
{
  Serial.print(buf[i]);
}

Your code says to print all 30 bytes of the array regardless of how many characters you have received. The array is defined inside a function and not given any initial values, so what you see is whatever garbage was at those memory locations when the array was created.

If you only want to print out the ones that were recently received then you need to keep track of how many characters you received and use that number in the for loop instead of the size of the whole array.

Sorry, jremington. Thanks to both of you!

Pin 0 and 1 are for uploading a sketch and the serial monitor for an Arduino Uno. Pin 0 and 1 together with 'Serial' is possible with a Leonardo and Micro board. Which boards do you use ?

If I need to I may switch the pin but anyways, I am using the Arduino Mega ADK for the transmitter, and the Arduino Nano 3.1 for the receiver.

When you do a Serial.println() on the Nano, it uses pin 0 as RX and pin 1 as TX. You use the same pin 1 to receive data from the 433MHz receiver. That will not work.

The Arduino Mega ADK also has the Serial port on pin 0 and 1. You don't use that serial port, but it is still connected to the usb-serial chip. So you better use another pin for the Mega board as well.