Trouble with Xbee to Xbee communication using 2 ardiunos

Hi, I am very new to using Xbees with the ardiuno and I am having trouble understanding the basics of there programming in ardiuno. I am using 2 DF robot xbee shield V1.4, I have 2 Xbee Maxstreams, as well as an ardiuno duemilanove, and ardiuno uno(should I use 2 of the same types of ardiunos, or will using these two work?). For my final project I would like to have a keypad send commands into the ardiuno through the xbee to another ardiuno with an xbee controlling a motor. At the moment I am using a DC motor but I have access to a lot of servos so i am thinking I will switch. One of my main questions is how do the xbees communicate? Do I have to send signals through the serial in order for them to communicate? I am also not to great at programming and am not sure how to sync the xbees frequencies. Do I do that in the programming, or before hand with a different program? I mainly need to figure out how to program the ardiuno to send and receive through the Xbees. I have gotten the keypad to work as well as the motor but integrating them with the xbees is turning out to be much more difficult then I had hoped. I would love any simple programming examples of ardiunos communicating with xbees. Any help would be greatly appreciated!

Tyler

will using these two work?

Yes.

Now that you have your first post out of the way, you can post links. I'm not familiar with the "Maxstream" designator. You need to post a link to the XBees that you have.

One of my main questions is how do the xbees communicate?

That doesn't really matter, does it? The important thing is that they do. There are different modes (AT and API) and different topologies (point to point or mesh network). As long as you have a matched set of XBees, properly configured, they do communicate. That's all that really matters. Whether they do it using semaphores or smoke signals or IR or AM or FM or UHF or VHF or something else doesn't really matter.

Do I have to send signals through the serial in order for them to communicate?

Yes.

I am also not to great at programming and am not sure how to sync the xbees frequencies.

You don't have to, programmaticly.

I mainly need to figure out how to program the ardiuno to send and receive through the Xbees.

Just like a wires connected TX of one Arduino to RX oi the other.

I would love any simple programming examples of ardiunos communicating with xbees.

If you can get the Arduino to communicate with the PC, its the same code for communicating with the XBee. Depending on the shield, you might need to use SoftwareSerial on two other pins, instead of Serial, but that would be the only change needed,

I think this is what you were looking for but i'm not positive. http://www.libelium.com/squidbee/upload/3/31/Data-sheet-max-stream.pdf

So I understand they send signals threw the serial port, what I can't see to understand is how to have them running at the same freuency. Is this done in the beginning of the ardiuno code? If so does it matter what frequency i choose as long as they are the same?

I think thats the rest of what I needed to know. Thank you very much PaulS!! Your post was very helpful!

i am not able to write this code on an xbee

could somebody help please

int EN1 = 6;  
int EN2 = 5;  //Roboduino Motor shield uses Pin 9
int IN1 = 7;
int IN2 = 4; //Latest version use pin 4 instead of pin 8
  
 
 
void Motor1(int pwm, boolean reverse)
        {
          analogWrite(EN1,pwm); //set pwm control, 0 for stop, and 255 for maximum speed
         if(reverse)
         { 
          digitalWrite(IN1,HIGH);    
         }
        else
        {
          digitalWrite(IN1,LOW);    
         }
        }  
         
void Motor2(int pwm, boolean reverse)
        {
          analogWrite(EN2,pwm);
         if(reverse)
         { 
          digitalWrite(IN2,HIGH);    
         }
        else
        {
          digitalWrite(IN2,LOW);    
         }
        }  
        
void setup() 
{ 
    int i;
   // for(i=6;i<=9;i++) //For Roboduino Motor Shield
   // pinMode(i, OUTPUT);  //set pin 6,7,8,9 to output mode
 
    for(i=4;i<=7;i++)  //For Arduino Motor Shield
    pinMode(i, OUTPUT);  //set pin 4,5,6,7 to output mode
 
    Serial.begin(9600);   
} 
 
 
void loop() 
{ 
  int x,delay_en;
  char val;
  while(1)
  {
    val = Serial.read();
    if(val!=-1)
       {
          switch(val)
           {
             case 'w'://Move ahead
                        Motor1(255,true);  //You can change the speed, such as Motor(50,true)
                        Motor2(255,true);
                       
                         break;
             case 'x'://move back
                        Motor1(255,false);
                        Motor2(255,false);
                         break;
             case 'a'://turn left
                        Motor1(255,false);
                        Motor2(255,true);
                         break;       
             case 'd'://turn right
                        Motor1(255,true);
                        Motor2(255,false);
                        break;   
               case 's'://stop
                        Motor1(0,false);
                        Motor2(0,false);
                         break;
                                   
           }     
         
       }
            
  }                           
}

i am not able to write this code on an xbee

Well, of course not.

could somebody help please

The makers of the XBee - digi.com - might, if you pay them enough to customize an XBee for you.

void loop() { int x,delay_en; char val; while(1) {

An infinite loop inside an infinite loop does not inspire confidence.