how can i read only 1 bytes at a time after i find my start of the packet which is 7E how can i read only the 12th byte of my packet fram which is contains 18 bytes . ??
The code below should give you a start. I have not tested it but it is the way I have done it a number of times.
Hope it helps,
wade
byte get_myByte();
int n_bytes;
byte discard, myByte
// I am assuming you have the packet coming into the receiving XBee and you have started Serial()
while(Serial.available() > 0)
{
n_bytes = Serial.available();
if(n_bytes >= 18)
{
if(Serial.read() == 0x7e)
{
for(int i = 1; i < 11; i++)
{
discard = Serial.read();
}
return(Serial.read());
}
// If you have gotten here you have an error so
// return a value that signifies an error
}
}