Problem with communication between two arduino with Xbee modules

Hello,
I have two arduino UNO boards, two wireless proto shield and two xbee modules.
I’ve programmed the arduino receiver so:

const int pinLed = 13;
int msg;
void setup() {
  Serial.begin(9600);
  pinMode(pinLed,OUTPUT);
  delay(1000);
}
void loop() {
  if(Serial.available()) {
    msg = Serial.read();
     if(msg=='A') {
    digitalWrite(pinLed,HIGH);
  }
  }
 delay(150);
}

and the sender:

void setup() {
  Serial.begin(9600);
  
}
void loop() {
Serial.print('A');
delay(150);
}

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?

Thanks in advance

Could you help me please?

No. You haven't provided near enough information.

I have two arduino UNO boards, two wireless proto shield and two xbee modules.

Which proto shields? Which XBee modules? How are the XBees connected to the Arduinos?

How are the XBees configured? Digi's claim that they work out of the box is pure bullshit.

But when i plug in the arduino with usb cable and activate the xbee, they don't communicate.

What does "and activate the XBee" mean? The XBee should be activated when the Arduino gets power.

i have this wireless proto shield: http://arduino.cc/en/Main/ArduinoWirelessProtoShield
i have xbee S2, and for "Activate xbee modules" i changed the serial select from USB to MICRO

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 can i change my code?

how can i change my code?

Generally, I use the IDE. But, you can choose the External Editor option, and use your favorite text editor.

If you mean "what do I change my code to look like", then I suggest that you answer all the questions I have asked first.

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.

i configured how say this tutorial http://blog.didierstevens.com/2009/06/15/quickpost-arduino-xbee-shield-series-2-configuration/ , but the the problem remains

If you are running the shield in MICRO mode, the XBee is connected to pins 2 and 3. You are reading from, and writing to, pins 0 and 1.

Either put the switch back in the USB position, or change your code to use SoftwareSerial to read from/write to pins 2 and 3.

I change my code but the problem remains
receiver:

#include <SoftwareSerial.h>
const int pinLed = 13;
SoftwareSerial mySerial(2,3);
int msg;
void setup() {
  Serial.begin(9600);
  pinMode(pinLed,OUTPUT);
  mySerial.begin(9600);
  delay(1000);
}
void loop() {
  if(mySerial.available()) {
    msg = mySerial.read();
     if(msg=='A') {
    digitalWrite(pinLed,HIGH);
  }
  }
 delay(150);
}

Sender:

#include <SoftwareSerial.h>
SoftwareSerial mySerial(2,3);
void setup() {
  Serial.begin(9600);
  mySerial.begin(9600);
  
}
void loop() {
mySerial.print('A');
delay(150);
}

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.

only the power led is on

Perhaps your shield uses different pins than 2 and 3. Try putting the switch in the USB position, and using Serial to write to/read from the XBees.

but if i use usb, xbees become useless

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 影音先锋手机av资源站_a√无码亚洲不卡播放网站_韩国一级毛一级a免费_国产精一品亚洲二区在线播放 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)

but if i use usb, xbees become useless

I don't understand this statement.

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

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.

But, you are trying to use API mode.