But when i plug in the arduino with usb cable and activate the xbee, they don't communicate.
I see many web-sites but i didn't found the solution.
Could you help me please?
Five questions. 3 answers (plus one implied). Not the best ratio. You missed the most important one.
When you move the switch from USB to MICRO, you are changing the serial pins that the XBee is connected to, from 0 and 1 to 2 and 3. Your code does not reflect that you are no longer connected to pins 0 and 1.
How are the XBees connected to the Arduinos? i only put the xbee module on wireless shield and then i put the shield on arduino
How are the XBees configured? i don't configured it because i only upload the programs on arduinos and connect the modules to arduinos
i don't configured it because i only upload the programs on arduinos and connect the modules to arduinos
Out of the box, no two XBees talk to each other. They must be configured. Exactly what needs to be set depends on the type of XBee. If you had Series 1 models, which are designed for point to point use, I could tell you.
Since you are trying to use two mesh network models for point to point use, I can not.
There are plenty of "How to configure Series 2 XBees" tutorials on the web.
There are lights on the shield. They should blink as the shield receives data and as the shield sends data. Do they blink? If not, you have software problems. If they do, then you have configuration issues.
i configured the two xbee modules one as coordinator and the other as router/end device i set the the same PAN ID (234) for both modules, then i upload the programs changing the pin from 2 & 3 to 10 and 11 but nothing was change. i don't know what can i do now please help
EDIT: Why in this example http://www.5thandpenn.com/blog/?p=54 the author can use that simple code to communicate two arduinos without problem of pin?
i saw that the arduino sender if i use the code with Serial (so the pin 0 for RX and 1 for TX) and switch the shield in micro mode the led RX started to blink,is it correct? (The arduino receiver doesn't receive the signal)
There are a number of areas where you could be having problems. The XBees might not be configured correctly, for what you are trying to do. The XBees may not be connected, when the switch is in the MICRO position, to pins 2 and 3. They may be connected to different pins, or the pin meaning might be reversed. The XBees might be defective, although this is unlikely.
One thing to try is changing the Arduino code to use the hardware serial port, and then putting the switch in the position to connect the XBee to the hardware serial pins. If that works, you've learned one thing. If it doesn't, you've learned something else. Learning won't hurt, you know.
I don't understand why you are using mesh network radios for point to point purposes.
i change the configuration of xbee modules from zigbee coordinator at for sender and router for receiver to ZNET 2.5 coordinator at and router. Now on the arduino sender the led tx rx blinking and the led RSSI is on but the arduino receiver doesn't receive signal