Good day!
I have 3 XBee PRO Series 2 Module, 2 Xbee PRO Shield, 1 Xbee 3.3v/5v Adapter and 1 Arduino UNO.
I’m currently using this connection:
PC <–> Arduino <–> XBee (C) ~~~~ XBee (R) <–> Sensor
~~~~ XBee (R) <–> Sensor
I’m trying to read the XBee serial address and the sensor values transmitted by the router.
This is the code I’m using in the coordinator side of the arduino:
#include
void setup(){
Serial.begin(9600);
}
void loop(){
if (Serial.available() >= 21){
if(Serial.read() == 0x7E){
for(int i=1; i<24; i++){
Serial.print(i);
Serial.print(": ");
byte discardByte=Serial.read();
Serial.println(discardByte, HEX);
}
}
}
}
The problem is I receive garbled bytes from the router.
These are the bytes I receive and the should be description:
7E - start byte
00 - length
12
92 - frame type
00 - 64bit source address
7D (should be, 0013A200, 40B77006)
33
A2
40
B7
70
06
56 - 16bit network address
B3
01 - receive option
01 - number of sample set
00 - digital channel mask
00
01 - analog channel mask
02 - digital sample data
10
2D - analog sample data
FF (should be 2 bytes every pin set)
FF - checksum
(should be 8bit sum minus 0xFF)
I disabled digital i/o except assoc and rssi and enabled 1 analog pin for temp sensor