xbee wireless communication using joystick

code at receiver side .

#include<EasyTransfer.h>
//#include<Wire.h>

int a1=2;
int a2=3;
int b1=4;
int b2=5;
int jack=6;
int m;
int n;

EasyTransfer lt;

typedef struct RECEIVE_DATA_STRUCTURE
{

int x;
int y;
int z;
};
RECEIVE_DATA_STRUCTURE aman;
//#define I2C_SLAVE_ADDRESS 9

void setup(){
//Wire.begin(I2C_SLAVE_ADDRESS);
lt.begin(details(aman),&Serial);
//Wire.onreceieve
Serial.begin(9600);
pinMode(a1,OUTPUT);
pinMode(a2,OUTPUT);
pinMode(b1, OUTPUT);
pinMode(b2,OUTPUT);
pinMode(jack,OUTPUT);

}

void loop()
{
if(lt.receiveData())

m=map(m,0,1023,-1,1);
n=map(n,0,1023,-1,1);

if(m==0 && n==0)
{
digitalWrite(a1,LOW);
digitalWrite(a2,LOW);
digitalWrite(b1,LOW);
digitalWrite(b2,LOW);
}

else if(m==0 && n==1)
{
digitalWrite(a1,HIGH);
digitalWrite(b1,LOW);
digitalWrite(a2,HIGH);
digitalWrite(b2,LOW);

}
else if(m==0 && n==-1)
{
digitalWrite(b1,HIGH);
digitalWrite(a1,LOW);
digitalWrite(b2,HIGH);
digitalWrite(a2,LOW);

}
else if(m==1 && n==0)
{
digitalWrite(a1,LOW);
digitalWrite(b1,LOW);
digitalWrite(a2,HIGH);
digitalWrite(b2,LOW);

}

else if(m==-1 && n==0)
{
digitalWrite(a1,HIGH);
digitalWrite(b1,LOW);
digitalWrite(a2,LOW);
digitalWrite(b2,LOW);

}

}

this is my arduino code for receiver side and i am using xbee for wireless communication , but the problem is i am not able to get the output on other side . plz help me .

code at transmitter side

#include<EasyTransfer.h>

int vx=A0;
int vy=A1;
int cam=8;
EasyTransfer lt;

struct SEND_DATA_STRUCTURE
{
int x;
int y;
int z;
};

SEND_DATA_STRUCTURE aman;

void setup()
{
pinMode(cam,INPUT);
Serial.begin(9600);
Serial.begin(9600);
lt.begin(details(aman),&Serial);

}
void loop()
{
aman.x=analogRead(vx);
aman.y=analogRead(vy);
aman.z=digitalRead(cam);
lt.sendData();

}

Try something like the SoftwareSerial examples first to make sure the XBee's are working.

yes i have tested my xbee and its working properly , the problem i am facing is of my code can you tell me that my code is right .

can you tell me that my code is right .

#7 below:

http://forum.arduino.cc/index.php/topic,148850.0.html

Similar discussion.

http://forum.arduino.cc/index.php?topic=332395.msg2293355#msg2293355

thanxx for the help sir , but i am working with dc motors, joystick and xbees . and the link you have given me is of servo and pot .
sir it would be great help if you can help with code which i have posted earlier in this thread .

Joysticks are just pots. And it is easy to convert servo commands to DC motor commands.

sir can you tell me the mode in which xbee should be configured , i mean which xbee as coordinator and which to router.

Transparent is great for XBees. They just take data and send it.

the problem i am facing is that the din light of one xbee is continuously blinking but in other xbee only rssi and power lights are on . i dont know how to overcome this problem . plz help me out .

Have you used X-CTU to configure your XBees?

yes sir i have used x-ctu to configure xbee but the xbees are not transmitting the data . plz help sir

Do you have the right baud rate? EDIT See http://cpham.perso.univ-pau.fr/WSN/XBee.html

Better to use #softwareserial Use 10 for Rx and 11 for Tx U must try communicate between xbee with 2 xbee explorer first

Use software serial library, Myserial.println(data);

sir both the xbees are communicating in there terminal but when any signal is given from joystick they are transmitting data . plz help sir