newbie having problem with UNO reading an XBEE frame

Hello,

I am now trying to learn to use Xbee in conjunction with a UNO.

I am having problems using the sample data on an Xbee frame.

when I run the following code:

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

void loop()
{
if (Serial.available()>21)
{
for (int i=0;i<26;i++)
{
Serial.print(Serial.read(),HEX);
Serial.print(", ");
}
Serial.println();
}
}

Result: Serial monitor reads as follows

7E, 0, 14, 92, 0, 13, A2, 0, 40, AF, 7D, B9, 77, FE, 1, 1, 0, 10, 8, 0, 10, 3, FF, F2, FFFFFFFF, FFFFFFFF,

So now I write a code to retrieve the useful information:

(0,10) Digital samples
(3,FF) Analog sample #1

int dataArray[04] = {};

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

void loop()
{
if (Serial.available()>21)
{
if (Serial.read()==0x7E)
{
for (int i=0;i<18;i++)
{
byte discard=Serial.read();
}
for (int i=0; i<4; i++)
{
dataArray = Serial.read();
_ Serial.println(dataArray*);_
_
}_
_
}_
_
}_
_
}*_
And result is:
0,16, 3, -1
I understand that 10 becomes Binary 16, and 3 remains the same - but why does FF (Binary 255) become -1??
I am sure there is a sensible reason, and apologise in advance for my possible stupidity :slight_smile:
Best regards,
Mark