API ID 0X17. Send an AT Command message from Xbee connected to arduino to a slave Xbee

22 Views Asked by At

I friends

I have a problem with ID 0x17. In my case, I tested to send an AT command from an Xbee coordinator (connected to an arduino mega) to a final Xbee just to change the node identification (NI), but I don't get any reception message in the XCTU. This is the code, maybe someone could help me.

    byte trama[] = { 0x7E, 0x00, 0x15, 0x17, 0x27, 0x00, 0x13, 0xA2, 0x00, 0x12, 0x34, 0x56, 0x78, 0xFF, 0xFE, 0x02, 0x4E, 0x49, 0x52, 0x65, 0x6D, 0x6F, 0x74, 0x65, 0xF6 };

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

void loop() {
  enviarTrama();
  delay(2000);
}

void enviarTrama() {
  Serial.println("Enviando trama...");
  for (int i = 0; i < sizeof(trama); i++) {
    if (trama[i] == 0x7E || trama[i] == 0x7D) {
      Serial1.write(0x7D);
      Serial1.write(trama[i] ^ 0x20);
    } else {
      Serial1.write(trama[i]);
    }
    Serial.print(trama[i], HEX);
    Serial.print(" ");
  }
  Serial.println();
}

I try to send AT commands to modify the state of the digital or analog pins of the slave Xbee by sending frames generated on the Arduino and sent through the Xbee coordinator

0

There are 0 best solutions below