help needed transferring values

I am reading two values of x and y axis using analog pins of accelerometer.I want to send these values via xbee to other arduino using softwareserial pins for xbee.
This is the code for sending side,

#include <SoftwareSerial.h>

SoftwareSerial XBSerial =  SoftwareSerial(2, 3);
const int xpin = A0;                  // x-axis of the accelerometer
const int ypin = A1;                  // y-axis

void setup()
{
  // initialize the serial communications:
  pinMode(xpin, INPUT);//x axis 
  pinMode(ypin, INPUT);//y axis
  
  Serial.begin(9600);
   Serial.println("testing");
  // set the data rate for the SoftwareSerial port
  XBSerial.begin(9600);
  XBSerial.println("testing!!!");
 pinMode(2, INPUT);    //rx is set to input
 pinMode(3, OUTPUT);   //tx is set to ouput
}

void loop()
{
 // print the sensor values:
  Serial.print(analogRead(xpin));
  Serial.print("/t");

  Serial.print(analogRead(ypin));
  // print a tab between values:

  Serial.println();
  // delay before next reading:
  
  
  int val=analogRead(xpin);
  
  
  int val2=analogRead(ypin);

 XBSerial.print(val);//changed from write to print
 XBSerial.print(val2);
 delay(10);
}

This is the code for receiving side which is giving random one digit numbers,

#include <SoftwareSerial.h>

SoftwareSerial XBSerial =  SoftwareSerial(2,3);


 int BackMotorForward =6;
 int BackMotorReverse =5;
 int FrontMotorRight =10;//right and left confusion
 int FrontMotorLeft =9; //right and left confusion
 int sv1=0;
 int sv2=0;
void setup () 
{

 pinMode(BackMotorForward, OUTPUT); // initialize the pin as an output.
 pinMode(BackMotorReverse, OUTPUT); // initialize the pin as an output.
 pinMode(FrontMotorRight, OUTPUT); // initialize the pin as an output.
 pinMode(FrontMotorLeft, OUTPUT); // initialize the pin as an output.
   
  Serial.begin(9600);

  // set the data rate for the SoftwareSerial port
  XBSerial.begin(9600);
 // XBSerial.println(".");


}
void loop()
{
if (XBSerial.available()>=2)//WAIT TILL DATA IS AVAILABLE ON XBEE  
{

  sv1=XBSerial.read();
  sv2=XBSerial.read();
  Serial.println(sv1);
  Serial.println(sv2);
   Serial.println();
}
 if( sv1 < 280 )//X OR Y WHICH IS SV1 AND WHICH IS SV2 CONFUSION VVVVVVVVVVVVVVVVVVVVVV
  {
    //Serial.write("forward");
  digitalWrite(BackMotorForward, HIGH);
   digitalWrite(BackMotorReverse,LOW);
  }
  
 else if (sv1 > 380 )
  {
    //Serial.write("backward");
    digitalWrite(BackMotorReverse,HIGH);
    digitalWrite(BackMotorForward,LOW);
  }
   
   else 
  {
    digitalWrite(BackMotorForward,LOW);
    digitalWrite(BackMotorReverse,LOW);
  }
  if (sv2 > 280)
  {
    //Serial.write("left");
    digitalWrite(FrontMotorRight, HIGH);
   digitalWrite(FrontMotorLeft,LOW);
  
  }
  else if (sv2 < 380 )
  
  {
    //Serial.write("right");
    digitalWrite(FrontMotorLeft,HIGH);
    digitalWrite(FrontMotorRight,LOW);
  }
  else
  {
    digitalWrite(FrontMotorRight,LOW);
    digitalWrite(FrontMotorLeft,LOW);
  }
}
XBSerial.flush();//check if necessary
  delay(10);
  }

I want to know the correct way to transfer these values.
PS.thanks for the correction @AWOL

Was there a question? It looks to me like the two (incomplete) codes are identical.

AWOL: Was there a question? It looks to me like the two (incomplete) codes are identical.

thanks for the correction. :)

getmesmerized: thanks for the correction. :)

Does that mean you have figured out a solution?

...R

Robin2: Does that mean you have figured out a solution?

...R

No mate I am still stuck at it.

And what is connected to the analogue inputs on the receiving side?

AWOL: And what is connected to the analogue inputs on the receiving side?

2 dc motors via L293D chip,there was some error while posting the code.Now it should be more clear

This is the code for receiving side which is giving random one digit numbers,

I see no evidence for this.

AWOL: I see no evidence for this.

Exactly,I have no idea what is wrong here,Can there be a datatype issue ,or something related to transferring of data bytes?

Maybe I'm misunderstanding something, but I don't understand the use of "giving" here, or how you can make the assertion.

AWOL: Maybe I'm misunderstanding something, but I don't understand the use of "giving" here, or how you can make the assertion.

The values which are coming from the accelerometer are of the range 150-450, which i store in an integer variable val. I send the value of that variable via xbee to the other arduino. The other arduino for some reason is not printing those values,instead its printing numbers like 4,5,7,8 etc

I checked if the other xbee was receiving correct values via XCTU and it shows correct values in the terminal of xctu. So,there is some problem with the code.

instead its printing numbers like 4,5,7,8 etc

I'll repeat - I see no evidence of any printing of single values in the code you posted.

XBSerial.print(val);//changed from write to print
 XBSerial.print(val2);

Tell me more about those two lines.

AWOL: I'll repeat - I see no evidence of any printing of single values in the code you posted.

I just used the serial print to check what values was the arduino getting to determine why my motors are not working properly

Serial.println(sv1); Serial.println(sv2);

i'll include it in the actual code for better understanding.

these are the values the serial monitor is showing for the above statements -35 7 3 9 -35 5 9 1 7 6 3 -38 3 6 0 1 6 1 -35 6 0 1 6 6 3 -38 3 6 2 1 6

AWOL: I'll repeat - I see no evidence of any printing of single values in the code you posted.

XBSerial.print(val);//changed from write to print
 XBSerial.print(val2);

Tell me more about those two lines.

these two lines are supposed to send the accelerometer values to the receiver xbee

No, I said "tell me more"

AWOL: No, I said "tell me more"

these two lines are sending values to the other xbee,they are used to tell the motors of the rc car to accelerate ,reverse or turn left or right. when i checked on xctu,the other xbee is receiving correct values, the problem is that when i store these in an int variable on the other arduino its not storing correct values

Imagine, for a moment, that "val" has the value 12, and "val2" has the value 540.

What does the receiver see?

the xbee receiver sees it as 12 and 540 itself.

what I want to do here is to store the value in "val" and "val2" to "sv1" and "sv2" respectively.