XBee library help

I am working on a project sending three analog signals serially using 2 series one xbees and two arduino megas. I recently found out i need to use API mode and the xbee library for the receiving side. I am a beginner to both xbee and arduinos and haven’t worked with C++ in a few years so I am having a lot of trouble with the receiving side. If anyone is willing to help it would be greatly appreciated!

Here are the details for anyone willing to help:

The project is a prosthetic arm that is currently programmed by a simulink code embedded into an arduino. There are three emg signals used to power the arm. These signals are being put into the analog pins of the arduino and read by the simulink code. Currently the human arm used to power the arm with the emg signals cannot exceed a length of two feet away from the prosthetic arm so the goal is to make it wireless to make this distance greater. I am planning on using this arduino to receive the signals. I am using a series one xbee, xbee sheild, and arduino mega on both sides. I am inputting the signals into the analog pins of the transmitting arduino to send to the receiving xbee. The transmitting xbee is in AT mode. The receiving xbee will be in API mode. The receiving arduino will only need to read the signals into a variable so that the Simulink code used to program the arm.

Here is my configuration for the xbees

Transmitting xbee:

Channel: 10

Pan ID:1234

MY: 10

DL: 11

Receiving xbee:

Channel: 10

Pan ID: 1234

MY: 11

DL: 10

API: enabled

transmitting Arduino program:

void setup() {
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
}
void loop() {
  // read the input on analog pin
  int sensorValue1 = analogRead(A0);
  int sensorValue2 = analogRead(A1);
  int sensorValue3 = analogRead(A2);
  // print out the value you read:
  Serial.write(sensorValue1);
  Serial.write(sensorValue2);
  Serial.write(sensorValue3);
  delay(100);      
}

I’ve been told i have to separate the signals in some way on the transmitting side but i’m not sure how to do that.

I tried looking at the example code from the xbee library for the receiving series one xbee but I wasn’t sure what needed to be changed from that. Here is a code with just some of the basic stuff. I’m not sure if everything is in the right order and i need to read in two more signals. All i need this code to do is read in the vales and assign them to different variables so simulink can read each signal.

#include <XBee.h>
XBee xbee = XBee();
void setup() {
  xbee.begin(9600);
}
Rx16Response rx16 = Rx16Response();
xbee.readPacket();
if (xbee.getResponse().isAvailable()) {
        if (xbee.getResponse().getApiId() == RX_16_RESPONSE) {
                xbee.getResponse().getRx16Response(rx16);
        }
}
rx16.getRemoteAddress16();
rx16.getRssi()
processPayload(rx.getData(), rx.getDataLength());
if (xbee.getResponse().isError()) {
// get the error code
xbee.getResponse().getErrorCode()
}

If anyone has any advice or knows how to write the code for this you will be a life saver and I can include your name in the acknowledgments in our final report. If any other information is needed let me know!