Let's Make Robots!

Xbee receiving in packets

My xbees are set to 9600 baud. There is a button hooked up to my arduino which is sending "hello" over the xbee to my receiving xbee which is plugged into my computer and is printing to the arduino ide serial monitor. I click the button about 6 times and after each push of the button "hello" is received and printed on my screen. That is ok. But then the xbee seems to stop for a while and i click the button a few times and nothing happens. After a few seconds of delay, "hello" appears on my screen however many times i clicked the button. So there seems to be a memory of how many times i clicked the button. This is no good for instant movement (this is on my rc controller i made). Any one have a idea of what is going on?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

I had a similar problem and this is what they told me on the arduino forums: "One possible issue i see is you don't have a delay in there to help ensure the buffer has all the data that was sent. "

I have a forum going on at diydrones.com too http://diydrones.com/forum/topics/xbee-is-delayed-and-sending-in?xg_source=activity with this question.

Here is the code 

 #include <LiquidCrystal.h>

 

 LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

int dPin = 8;

int cPin = 6;

int ePin = 7;

int bPin = 10;

int aPin = 13;

 

void setup(){

 

  lcd.begin(16, 2);

  pinMode(dPin, INPUT);

  digitalWrite(dPin, HIGH);

  pinMode(aPin, INPUT);

  digitalWrite(aPin, HIGH);

  pinMode(ePin, INPUT);

  digitalWrite(ePin, HIGH);

  pinMode(bPin, INPUT);

  digitalWrite(bPin, HIGH);

   pinMode(cPin, INPUT);

  digitalWrite(cPin,HIGH);

Serial.begin(9600);

 

 

}

 

void loop(){

    if(digitalRead(cPin) == 0){

    Serial.println("hello");

    delay(200);

    }

}

Have you tried using Low instead of 0 for if(digitalRead(cPin) == 0)

just did and it did not change the effect.

Seeing how this program works fine using the cable but not using the xbee, it must be the xbee.

I'm not familiar enough with the xbee or the tool to config it, but do you know if iti has a buffer read that waits for a certain amount of data? That could something to look at.

 

familiarized myself with a bit of it and found something that could cause the issue you are seeing.

http://www.ladyada.net/make/xbee/arduino.html

1/4 page down it mentioned packetization timeout.

"Next we'll set the Packetization Timeout. This is what determines how long to wait before sending the characters over. We're doing some 'bulk transfer' when sending 10K programs over, so you'll probably want this number high like 10"

This could potentually cause an issue and if as you say it looks like an xbee thing then something like this setting would do it.

 

they were set to 3 now set to 0 but still no change.

mmm....not sure man.