hi can any one help me please i am trying to get a joystick shield to control 2 servos(pan tilt) wireless i have 2 xbee sheilds; 2 arduinos; 2 xbee modules; 1 joy stick shield; can some one help with code
I am not going to just give you my code as it was written as work for hire, but I will tell you generally how I do it. First I took joystick input and mapped it to a coordinate system. Think of joystick straight up as 0,0 and other positions as points to plot. Then write a function that accepts joystick coordinates as input and adjusts the servo settings. Get that working on just one Arduino. Then create a packet like "JOY:X,Y" where X and Y are your coordinates and send it via xBee using Serial.println. On the receiving side, buffer input between carriage returns and/or line feeds and then examine the packets, take them apart and interpret the numbers (actually, pass pointers to the character offsets into atoi; you don't really have to take the string apart) and pass the coordinates into the function you wrote earlier.
I like using strings because you can test this by using a terminal program and typing in the characters by hand for the servo controller and/or viewing output from the controller with the joystick.
EDIT - BTW, I don't want to discourage you from using Arduinos, but what you are trying to do is done by really simple off shelf stuff you can get at any R/C hobby shop. Unless there is a lot more to the application that you haven't told us about (in my case, this is just the tip of the 'berg) it seems like massive overkill to use Arduinos.