Hello,
I am trying to remotely control digital I/O pins on a XBee from an Arduino Uno. I am using 2 Series 1 Xbees, a Xbee Explorer, and a Xbee Arduino shield. The Xbee attached to the Arduino has its API mode disabled, while the remote XBee's API mode is enabled.
I am using a program, shown in this video tutorial, that will send a frame, toggling DIO pin 3 high or low. When I try to send a remote AT command frame, it is displayed in XCTU as a RX Packet 16-bit address, instead of an AT command. I noticed that there are 8 bytes before my desired frame, and one byte right after it, as shown in the attached image. Correspondingly, DIO 3 of the remote XBee is not set to high or low when viewed in XCTU. This is the code for the Arduino, also from the video tutorial:
//code by tunnelsup
//youtube tutorial: https://www.youtube.com/watch?v=CzH146rR-7I
//toggles local LED and remote XBee LED on and off
int led = 13;
void setup(){
pinMode(led, OUTPUT);
Serial.begin(9600);
}
void loop(){
digitalWrite(led, HIGH);
setRemoteState(0x5);
delay(5000);
digitalWrite(led, LOW);
setRemoteState(0x4);
delay(5000);
}
void setRemoteState (char value){
Serial.write(0x7E); //start byte
Serial.write((byte)0x0); //high part of length (always zero)
Serial.write(0x10); //low part of length
Serial.write(0x17); //0x17 is remote AT command
Serial.write((byte)0x0); //frame ID set to zero for no reply
//ID of recipient, or use 0xFFFF for broadcast
Serial.write((byte)0x0);
Serial.write((byte)0x0);
Serial.write((byte)0x0);
Serial.write((byte)0x0);
Serial.write((byte)0x0);
Serial.write((byte)0x0);
Serial.write(0xFF);
Serial.write(0xFF);
//16 bit of recipient of 0xFFFE
Serial.write(0xFF);
Serial.write(0xFE);
Serial.write(0x02);
//command name in ASCII character
Serial.write('D');
Serial.write('3');
//command data in as many bytes
Serial.write(value);
//checksum
long sum = 0x17 + 0xFF + 0xFF + 0xFF + 0xFE + 0x02 + 'D' + '3' + value;
Serial.write(0xFF - (sum & 0xFF));
}
I feel that there might be a setting that I am missing, since it appears that everything sent to the remote Xbee is interpreted as a RX packet.
I appreciate any help. Thanks!
