Xbee Series 1 and Arduino Mega

I am trying to send packets from one arduino to another using the XBP24-AWI-001 modules and the libelium Xbee shields. I need to send an array of latitude and longitude coordinates as packets.

I looked over the Arduino Xbee library and examples at GitHub - andrewrapp/xbee-arduino: Arduino library for communicating with XBee radios in API mode but I still need some direction.

Also, how should the pins of the shield be connected if I don't want to use the Software Serial and have it on a breadboard and using the hardware serial pins? What is the main benefit of using the shield? Thanks.

What is the main benefit of using the shield?

Over using what? The XBees use non-breadboard-compatible pin spacing, so you need some sort of adapter. Also, the XBee is a 3.3V device. The shield manages the voltage drop for you. Finally, using the shield means you don't have to worry about how to connect the right pins together.

The XBee library looks pretty straightforward. The payload array is where you put your data. The uint8_t type is the same size as a char, so you could user char instead. You might need to do a cast later, but that's easy enough.

Use sprintf to write the data into the array:

sprintf(payload, "Lat: %f Long %f", lat, long); // Assuming lat and long are floats

Then, use strlen instead of sizeof to get the size of array for the 3rd argument for the ZbTxRequest constructor.

There are size constraints on the board, so I need to mount the xbee shield next to the arduino mega. Also, I am connecting the GPS module and LED screen to the VCC and ground pins on the mega board and these pins are covered up by the shield.