XBee series 2 AT mode and 2 arduinos

I have 2 xbees series 2 and have them configured to send information back and forth so I wanted to use a pot and servo and I am about to send values and read them using XCTU. The numerical values show on the the receiving xbee. When I connect it to the arduino I am getting -1 and thats the only thing I receive. I know there has to be an easy solution.

Thanks in advance for any help

Transmit Code

int potPin = 0;
#include

XBee xbee = XBee();
void setup() {
// Serial port enable
Serial.begin(9600);
xbee.begin(9600);
}

void loop() {

// remap values from the analogValue5 variable to 0 / 255
int val = map(analogRead(potPin), 0, 1023, 0, 9);

// send the value to the serial port
Serial.print(val);
xbee.send(val);
delay(50);

}

Receive Code

#include

int servoPin = 9;
Servo myservo;
void setup() {
Serial.begin(9600);

myservo.attach(servoPin);

}

void loop() {

while(Serial.available()>0);

int data = Serial.read();
int pos = map(data, 0, 9, 0, 180);
pos = constrain(pos, 0, 180);

myservo.write(pos);

Serial.println(data);
Serial.flush();
}

I believe this is a duplicate post. If not, please state so.