Can't see XBee data using Arduino with serial monitor.

Hi! I'm using 3 Xbees. 2 are configured as router AT and the other one as coordinator AT. The codes on the routers are for reading temperatures from a LM and from 3 OneWire DS18B20 sensors :

#include <SoftwareSerial.h>

float temp;
int tempPin = 0;

SoftwareSerial xbee(4, 3);

void setup()
{
Serial.begin(9600);
xbee.begin(9600);
}

void loop()
{
delay(1000);
temp = analogRead(tempPin);
temp = temp * 0.48828125;
//Serial.print("TEMPRATURE = ");
//Serial.print(temp);
// Serial.print("*C");
//Serial.println();
//delay(1000);
xbee.print("Temp D: "); xbee.print(temp);
delay(1000);
}

and

#include <OneWire.h>
#include <DallasTemperature.h>
#include <SoftwareSerial.h>

// Data wire is plugged into pin 3 on the Arduino
#define ONE_WIRE_BUS 8

// Setup a oneWire instance to communicate with any OneWire devices
OneWire oneWire(ONE_WIRE_BUS);

// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);

DeviceAddress camera1Temp = { 0x28, 0xF6, 0x7C, 0xA0, 0x05, 0x00, 0x00, 0x0E };
DeviceAddress camera2Temp = { 0x28, 0x2A, 0x61, 0xDD, 0x03, 0x00, 0x00, 0xC3 };
DeviceAddress camera3Temp = { 0x28, 0x52, 0x8D, 0x30, 0x05, 0x00, 0x00, 0x04 };

SoftwareSerial xbee(4, 3); // RX, TX

void setup(void)
{
// start serial port
Serial.begin(9600);
// Start up the library
sensors.begin();
// set the resolution to 10 bit (good enough?)
sensors.setResolution(camera1Temp, 10);
sensors.setResolution(camera2Temp, 10);
sensors.setResolution(camera3Temp, 10);

xbee.begin(9600);

}

void printTemperature(DeviceAddress deviceAddress)
{
float tempC = sensors.getTempC(deviceAddress);
if (tempC == -127.00) {
Serial.print("Eroare citire temperaturi");
} else {
Serial.print("C: ");
Serial.print(tempC);
Serial.print(" F: ");
Serial.print(DallasTemperature::toFahrenheit(tempC));
}
}

void loop(void)
{
delay(2000);
//Serial.print("Citire temperaturi...\n\r");
sensors.requestTemperatures();

/*delay(1000);

Serial.print("Temperatura in camera 1: ");
printTemperature(camera1Temp);
Serial.print("\n\r");
delay(1000);
Serial.print("Temperatura in camera 2: ");
printTemperature(camera2Temp);
Serial.print("\n\r");
delay(1000);
Serial.print("Temperatura in camera 3: ");
printTemperature(camera3Temp);
*/

float temp1 = sensors.getTempC(camera1Temp);
float temp2 = sensors.getTempC(camera2Temp);
float temp3 = sensors.getTempC(camera3Temp);
/*Serial.print(int(temp1*100));
delay(1000);
Serial.println(int(temp2*100));
delay(1000);
Serial.println(int(temp3*100));
*/

//Serial.print("\n\r\n\r");

xbee.print("Temp A: "); xbee.print(temp1);
delay(100);
xbee.print("Temp B: "); xbee.print(temp2);
delay(100);
xbee.print("Temp C: "); xbee.print(temp3);
delay(100);

}

When connecting the XBee coordinator in X-CTU i can see the receiving text and temperatures. But I can't see anything when connecting the XBee coordinator to an Arduino. I connected the XBee to the arduino on pins 0 and 1 not 3 and 4 as with the routers.(I tried with them too)

void setup()

{

Serial.begin(9600);

}

void loop()

{

if (Serial.available()>0)

{

Serial.write(Serial.read());

}

}

After this I want to procces the incoming text from the 4 sensors....but I can't see anything on the arduino. Can anyone figure out what is wrong?

You are reading and writing to the same serial input.
You need to establish two serials one for data in and one to write out from. I used a Leonardo because it has two serials, or a mega which has more. on the Leonardo the xbee is setup for Serial1 so read from that and write to Serial which is the usb to computer connection.

/Using leonardo to monitor serial data being sent via xbee
xbee set on Serial1 on Leonardo by default and reading from
Serial1 to Serial which is the usb uart connected to computer
and able to be monitored through serial monitor in arduino.
Dominik Krzanowski 02/11/2014
/

void setup(){
Serial.begin(9600); //make sure serial monitor is set to correct baud rate.
Serial1.begin(9600);
}

void loop(){
if (Serial1.available()>0){
Serial.write(Serial1.read());
}
}