Send DATA (temperature) from arduino+xbee shield+xbee to xbee+PC in mode API

Hi guys!
How are you? I've came here to ask if someone knows how to send data, like a message using xbee's (end device and coordinator) in mode API???? I need that part of the code please. Im using a 6 digital temperature sensor's in a one-wire protocol (1 wire, several sensors attached) connected to arduino+xbee shield+xbee and, i want to send this temperatures to another xbee connected to a PC using mode API with the program X-CTU. The part that i have working in mode AT of xbee and it worked is this:

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

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

// 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);

// Assign the addresses of your 1-Wire temp sensors.
// See the tutorial on how to obtain these addresses:
// Arduino 1-Wire Address Finder

DeviceAddress sensor1 = { 0x28, 0x18, 0x4F, 0x24, 0x03, 0x00, 0x00, 0xF8 };
DeviceAddress sensor2 = { 0x28, 0x34, 0x51, 0x24, 0x03, 0x00, 0x00, 0xED };
DeviceAddress sensor3 = { 0x28, 0x22, 0x84, 0x24, 0x03, 0x00, 0x00, 0x88 };
DeviceAddress sensor4 = { 0x28, 0x2A, 0x78, 0x24, 0x03, 0x00, 0x00, 0xAE };
DeviceAddress sensor5 = { 0x28, 0x01, 0x4F, 0x24, 0x03, 0x00, 0x00, 0x35 };
DeviceAddress sensor6 = { 0x28, 0x4F, 0x88, 0x24, 0x03, 0x00, 0x00, 0x20 };

int myData = 3;

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(sensor1, 10);
sensors.setResolution(sensor2, 10);
sensors.setResolution(sensor3, 10);
sensors.setResolution(sensor4, 10);
sensors.setResolution(sensor5, 10);
sensors.setResolution(sensor6, 10);
}

void printTemperature(DeviceAddress deviceAddress)
{
float tempC = sensors.getTempC(deviceAddress);
if (tempC == -127.00) {
Serial.print("Error getting temperature");
} else {
Serial.print("C: ");
Serial.print(tempC);
}
}

void loop(void)
{
delay(2000);
sensors.requestTemperatures();

printTemperature(sensor1);
printTemperature(sensor2);
printTemperature(sensor3);
printTemperature(sensor4);
printTemperature(sensor5);
printTemperature(sensor6);

}
Thank you

You have to configure the XBees using X-CTU to talk to each other. Set one as the coordinator, the other as a non-coordinator. Then set the receiving address of each XBee to the address of the other.

Then you should be able to treat the XBee on your Arduino as a standard serial port.

Alternatively, you can use an XBee library, but I personally don't like the one I tried.

EDIT: maybe you don't need to configure them. I'm reading the datasheet and product manual now for a personal project. I suggest you do the same. Those are the authoritative sources on how to use XBees.

Yep, reading the datasheet really sheds some light on this. It's worth an hour of your time to give it a good once-over. There are a lot of ideas out there on XBee communications, none of which are as lucidly communicated as the information in the datasheet.

Hi! I allready configured the xbee's to api mode and used the code above to program the arduino and nothing!! Thanks for the advice but i've read the datasheet and i can't implement anything of those things. I'm using six DS18B20 sensors in one-wire protocol, connected to PIN3 (DQ) of arduino. I want to send the temperatures measures throught the xbee to another xbee connected to a PC to receive the packet in API MODE. How can i do this? Thank you for your help!

Hi, I'm using the 800.15.4 (series 1) and (like many many others) am getting, well... squat and would appreciate any help - at all.

Here's the code I'm using that reads and lights up an led to recognize its at least receiving, then echo's back the character received :

void setup() {
Serial.begin(9600); //initialize serial
pinMode(13, OUTPUT); //set pin 13 as output

digitalWrite(13, HIGH);
delay(500);
digitalWrite(13, LOW);
delay(500);
digitalWrite(13, HIGH);
delay(500);
digitalWrite(13, LOW);

}

void loop() {
while(Serial.available()){ //is there anything to read?
char getData = Serial.read(); //if yes, read it
digitalWrite(13, HIGH);
delay(250);
Serial.print(getData);
delay(250);
}

digitalWrite(13, LOW);
}

here are the results on x-ctu. Data entered in sequence 1,2,3 etc.. and getting periods back. I was hoping it would look like this 11,22,33 etc.. but no. What am I doing wrong????

Notice how entering 5 and 7 return the same hex value??? good grief.

Hi. Just got it working correctly!!!! Yeeeeeeeee - HAAAAAAAAAAAA!!!! SUCCESS!!!!! how sweet it is...

Incredibly my atmega328p was damaged (probably when I tried making a power inverter) - note: if anyone is planning on making a power inverter make absolutely sure you use opto-couplers. The strange thing about the damaged atmega328p is that I had no problem uploading .pde's and turning pins on and off but somehow the RX/TX was damaged.