Home/Support/Support Forum/Bee S2 + Arduino AT Command problems with less than 50ms

Bee S2 + Arduino AT Command problems with less than 50ms

0 votes
Hello!.
I am working on a prototype of light tower for trail running, and I am using an Arduino One, and 10 Xbee S2. The coordinator API with the arduino I use a Xbee Shield from SainSmart.

The problem is with a very basic AT Command to blink on/ Off a led...this is not working if between On stage to Off Stage we have a delay less than 2000 ms, and I need to decrease this value on to 50ms.

When I use a delay less that 2000 ms; the Arduino + Xbee the remote led; just blink a couple of time, and the base Bee-Arduino, just blink 5 times. When I use a delay 2000ms...Everything work perfectly...but I need to work on 50 ms

Below you can see the Sketch that I am using:

//Xbee003.000_test1.ino
const int bLEDPin = 3;
const int gLEDPin = 5;
const int rLEDPin = 6;

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

pinMode(bLEDPin, OUTPUT);
pinMode(gLEDPin, OUTPUT);
pinMode(rLEDPin, OUTPUT);

digitalWrite(bLEDPin, LOW);
digitalWrite(gLEDPin, LOW);
digitalWrite(rLEDPin, LOW);

}

void loop() {
digitalWrite(bLEDPin, HIGH);
digitalWrite(gLEDPin, HIGH);
digitalWrite(rLEDPin, HIGH);
setRemoteState(0x05);

delay(2000);

digitalWrite(bLEDPin, LOW);
digitalWrite(gLEDPin, LOW);
digitalWrite(rLEDPin, LOW);
setRemoteState(0x04);

delay(2000);
}

void setRemoteState(char value){
Serial.write(0x7E); //Start byte frame
Serial.write(0x00); //High part of lenght Frame 00
Serial.write(0x10); //Low part of lenght Frame(the number of bytes that follow, not including checksum)
Serial.write(0x17); //Frame type -Remote AT Command
Serial.write(0x01); //Frame ID 01
//ID of recipient; or use 0xFF FF for broadcast
Serial.write(0x00);
Serial.write(0x00);
Serial.write(0x00);
Serial.write(0x00);
Serial.write(0x00);
Serial.write(0x00);
Serial.write(0xFF);
Serial.write(0xFF);
//16 bit of recipient or 0xFF FE if Unknown or broadcast
Serial.write(0xFF);
Serial.write(0xFE);
Serial.write(0x02); //to apply changes immediately
//Command name in HEX
Serial.write(0x44);
Serial.write(0x31);
Serial.write(value);

//Checksumis all bytes after lenght bytes
long sum = 0x17 + 0x01 + 0xFF + 0xFF + 0xFF + 0xFE + 0x02 + 0x44 + 0x31 + value;
Serial.write(0xFF - ( sum & 0xFF));
//delay(10);


}
asked Jul 5, 2016 in XCTU by luisfelipeyb New to the Community (0 points)

Please log in or register to answer this question.

1 Answer

0 votes
Did it ever occur to you that you are exceeding the capabilities of the Zigbee mesh network you are working with?
answered Jul 8, 2016 by mvut Veteran of the Digi Community (11,298 points)
...