Home/Support/Support Forum/Xbee Pro S1 cannot decode the message

Xbee Pro S1 cannot decode the message

0 votes
Hello,

I got two Xbee Pro S1, which is one them as a receiver and another as being a one-device. When I send a message from one-device the receiver cannot show the message only the ack light at Xbee turns on. My question is how to show the message, what the function of the hex value in this code ( if ((RxB[10]==0x56)&&(RxB[11]==0xAE)){
Serial.print("HUAWEI PHONE");
}
else if ((RxB[10]==0x12)&&(RxB[11]==0xFE)){
Serial.print("HLIDAZE JEWELRY");
)
and where can I find the value in Xbee which I believe had a different code depending on the Xbee itself?



***** One-Device COde *****
#include <SoftwareSerial.h>
#include "Arduino.h"
SoftwareSerial SerialXBee(10,11);
int ledPin = 10;
int ctsPin = A7; ///input constant sensor

int count=0;
int xx=0;

/*XBEE variable*/
volatile byte TxB[60];
volatile byte RxB[60] = {0};
float intial_value;
bool motion = false;

void setup()
{
Serial.begin(9600);// serial monitor
SerialXBee.begin(9600);// xbee
pinMode(ledPin, OUTPUT);
pinMode(ctsPin, INPUT);

}

void loop()
{
int ctsValue = digitalRead(ctsPin);
int sensorValue = analogRead(A5);


intial_value = 0;
sensorValue = constrain(sensorValue, 0, 255);
//Serial.println(sensorValue);
delay(250);

if (sensorValue > 0){// in motion, // ready to transmit data
TXData_Motion();
for (int d = 0; d <= 18; d++) {
SerialXBee.write(TxB[d]);
}
}
void TXData_Motion(){
TxB[0] = 0x7E; //nc
TxB[1] = 0x00; //MSB length
TxB[2]= 0x0F ;// data length
TxB[3] = 0x10; //nc
TxB[4] = 0x01; //nc
TxB[5] = 0x00; //nc
TxB[6] = 0x00; //nc
TxB[7] = 0x00; //nc
TxB[8] = 0x00; //nc
TxB[9] = 0x00; //nc
TxB[10] = 0x00; //nc
TxB[11] = 0x00; //00-> send to reader
TxB[12] = 0x00; //00-> send to reader
TxB[13] = 0xFF; //nc
TxB[14] = 0xFE; //nc
TxB[15] = 0x00; //nc
TxB[16] = 0x00; //nc
TxB[17] = 0x59; // motion status ='Y'
TxB[18] = 0x98;


}

void TXData_NoMotion(){
TxB[0] = 0x7E; //nc
TxB[1] = 0x00; //MSB length
TxB[2]= 0x0F ;// data length
TxB[3] = 0x10; //nc
TxB[4] = 0x01; //nc
TxB[5] = 0x00; //nc
TxB[6] = 0x00; //nc
TxB[7] = 0x00; //nc
TxB[8] = 0x00; //nc
TxB[9] = 0x00; //nc
TxB[10] = 000; //nc
TxB[11] = 0x00; //00-> send to reader
TxB[12] = 0x00; //00-> send to reader
TxB[13] = 0xFF; //nc
TxB[14] = 0xFE; //nc
TxB[15] = 0x00; //nc
TxB[16] = 0x00; //nc
TxB[17] = 0x4E; // motion status ='N'
TxB[18] = 0xA3;


}

***** Receiver Code *****
#include <SoftwareSerial.h>
#include "Arduino.h"

SoftwareSerial SerialXBee(10,11);
int ledPin = 10;
int ctsPin = A7; ///input constant sensor

int count=0;
int xx=0;

/*XBEE variable*/
volatile byte TxB[60];
volatile byte RxB[60] = {0};
float intial_value;
bool motion = false;
unsigned long A;

void setup()
{
Serial.begin(9600);// serial monitor
SerialXBee.begin(9600);// xbee
pinMode(ledPin, OUTPUT);
pinMode(ctsPin, INPUT);

}

void loop()
{
//int ctsValue = digitalRead(ctsPin);
//int sensorValue = analogRead(A5);


//intial_value = 28;
//sensorValue = constrain(sensorValue, 0, 255);
//Serial.println(sensorValue);
delay(250);

// ready to transmit data
//Serial.println("Before receive");
Receive();

}

void Receive(){
byte data=0,c=0;
while (SerialXBee.available()>=17){//change
if(SerialXBee.read()==0x7E){
RxB[0]=0x7E;
for(int r=1;r<17;r++){ //for(int r=0;r<17;r++)
RxB[r] = SerialXBee.read();
}

for (int i=4;i<12;i++){//xbee id:
if (RxB<0x10) Serial.print("0");
Serial.print(RxB, HEX);
}
Serial.print(",");

if ((RxB[10]==0x56)&&(RxB[11]==0xAE)){
Serial.print("Brunswick Blue");
}
else if ((RxB[10]==0x12)&&(RxB[11]==0xFE)){
Serial.print("HLIDAZE JEWELRY");
}
A=RxB[15];
if(A==0x59){
Serial.print("BEWARE!!!! DEVICE IN MOTION");
}
else{
Serial.print("DEVICE SAVE (NO MOTION)");
}
Serial.println("");
}

}
}
asked Nov 2, 2021 in IEEE 802.15.4 by Kimi New to the Community (0 points)

Please log in or register to answer this question.

1 Answer

0 votes
This is not something that Digi Support can help with. This is something your Arduino support would need to assist with.
answered Nov 9, 2021 by mvut Veteran of the Digi Community (14,881 points)
...