HELP to Serial Transmission Please!

I need help to transmit four data for a joystick, to arduino to another arduino via RF antennas, I don't know how to send it in an effective manner. PLEASE help me!

I need to send and recive these four numbers:

long joystick = 0000;

joystick = analogRead (A0); / / 0000 to 1024

I need help, I thank you very much!

What hardware do you have ( RF )?

What library/driver do you plan on using?

Do you have more than two lines of code? If so can we see it?

from above link download rcswitch library add in arduino library

and use the rc send example available in rcswitch library folder.

I use to transmit antennas that just connect the TX and RX, and you act as if you had a serial ordinary, and I don't use librarys.
I use this antennas: http://img.dxcdn.com/productimages/sku_143011_1.jpg

1:Arduino Sends data

long joystick1 = 0000;

void setup();
{
Serial3.begin(19200);
[
void loop()
{
joystick1 = analogRead (A0); / / 0000 to 1024
Serial3.println(joystick1);
delay(100);
}

1:Arduino reciving data

long joystick1 = 0000;

void setup();
{
Serial3.begin(19200);
[
void loop()
{
joystick1 = Serial.read();
delay(100);
}

I have used these modules before as well, they are quite good.

You need to have some kind of protocol defined for your communication, especially if you want to expand it to other commands like buttons, etc.

But to get you started, this code will send the number as 2 bytes across, and on the other side it will wait until it has 2 bytes, and then combine them to get the value. Ideally you need to add start bytes and end bytes, and perhaps even checksums into your data so that if the packets do not come across 100% that you can discard them and wait for a complete packet. The code I am giving you could get out of sync if one of the bytes are lost, and the other goes through successfully.

On the Transmitter side:

    joystick1 = analogRead (A0); / / 0000 to 1024
    Serial3.write(joystick1 >> 8);  //write writes the actual byte value, as opposed to the string representation of the number
    Serial3.write(joystick1);

On the Receiver side:

  if (Serial.available() >= 2) { //wait until we have at least 2 bytes in the buffer to read.
    joystick1 = (((unsigned int)Serial.read()) << 8) + Serial.read(); //reconstruct it from the 2 bytes
   // do something with the value here.
  }

Also, just confirm which Serial port you are using, because you seem to jump between Serial3 and Serial in your receiving code.

at all times send me the serial number 2, you know what happens or my mistake?

cap1_arduino_forum_eqf.png