serial.read help

Hi,

I am using following setup and trying to communicate two Xbee modules:

  • Arduino Duemilanove
  • Sparkfun Xbee shield (not Arduino one)
  • Two XBee Pro 50mW Series 2.5
  • One Xbee Explorer USB

I am having some problems with serial.read and serial.available

I made the setup through the guide given on http://blog.kevinhoyt.org/wp-content/xbee-setup.pdf

and uploaded the code

#define ledPin 13
byte pinState = 0;
void setup() {
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
}
void loop() {
Serial.println("testing...");
// toggle an LED just so you see the thing's alive.
toggle(13);
delay(1000);
}
void toggle(int pinNum) {
// set the LED pin using the pinState variable:
digitalWrite(pinNum, pinState);
// if pinState = 0, set it to 1, and vice versa:
pinState = !pinState;
}

I managed to see "testing..." on X-CTU terminal.

However I tried to use this following code given on the tutorial of serial.read.

int incomingByte = 0;      // for incoming serial data

void setup() {
      Serial.begin(9600);      // opens serial port, sets data rate to 9600 bps
}

void loop() {

      // send data only when you receive data:
      if (Serial.available() > 0) {
            // read the incoming byte:
            incomingByte = Serial.read();

            // say what you got:
            Serial.print("I received: ");
            Serial.println(incomingByte, DEC);
      }
}

But I dont get any response from X-CTU terminal. I did write number even words but no response. I am an Arduino newbie so I will be glad if you help me on what to do.

In general I was able to get data from my Arduino board through Xbee but I couldnt make Arduino work according to my commands put in X-CTU terminal.

What is the end result of this project? If it to get two Arduinos to communicate wirelessly with each other, then, you bought the wrong kind of XBees for that. The Series 1 modules communicate with each other. The Series 2.5 modules communicate in a mesh network.

I was able to get one Series 2,5 to talk to another one, but never to get a response.

As I said I was able to receive data from Arduino to X-Ctu terminal like I can see the result of Serial.println("testing....") on my X-CTU terminal

However if I try to send commands from X-ctu to Arduino then I receive no response. We tried it with Xbee Series 1 and it worked.

There is nothing I can do to make point to point communication with Xbee series 2.5?

Well I called the place I bought it and asked for a guide they told me to restore both xbee's using Restore button on X-CTU/Modem Configuration. Then I setupped them again with only changing their PanID and node identifier. Now I managed to make them work.

They told me it might some restores to make XBee Series work in two ways. I hope it can help others to work with Xbee 2.5 too