Home  >  Support  >  Support Forum  >  X-Bee Data Transfer From Terminal Slow: Snow plow robot
Notice! We've recently migrated to using a new forum, we hope you enjoy it. If you are an existing member and this is your first time visiting our new forum, please reset your password to be able to sign in.

X-Bee Data Transfer From Terminal Slow: Snow plow robot

0 votes
I have been working with Arduino for a while now but just got into the wireless (xbee) type of coding. I am trying to wirelessly control a robot from the computer using the x-ctu terminal but am getting slow responses from the readout. A few facts before continuing:

1) The communication between the two xbees is setup (2x XB24-ZB)
2) I have 2 servos which are mimicking the drive wheels (left and right)
3) When a drive command is prompted in the x-ctu termial window the respective the response is slow and the delay is long (multiple commands print in the window before the robot moves)
4) not sure if this is related but when i do a range test in x-ctu i only get "bad" packets back, never "good", i think this might have something to do with the tx and rf not being connected on the robot side xbee
5) The xbees are in "zigbee end device at" for the robot xbee and "zigbee coordinator at" for the computer xbee
6) Baud rate is 9600

It almost seems like the xbees are not processing the information fast enough. The code i am using is below, very simple just to get the xbee up and running (see below). Goal of this code is to have the servos run when a command prompt is given from the x-ctu terminal window and for the servo directions to change with no delay if a different command is given. Once this is up and running it will be going into my semi autonomous wheel chair snow plow robot so i can control it from inside if it gets out of hand.

Please let me know if additional information is needed.





"#include <Servo.h>

Servo rightServo;
Servo leftServo;

int leftF = 20;
int rightF = 135;
int leftB = 135;
int rightB = 20;
int leftS = 90;
int rightS = 90;

int turnTime = 20;

void setup()
{
Serial.begin(9600);
rightServo.attach(3);
leftServo.attach(5);
}

void loop ()
{
if(Serial.available()>0){
byte info=Serial.read();
Serial.println(info);

//forward
if(info=='w'){
rightServo.write(rightF);
leftServo.write(leftF);
delay(100);
}

//backward
if(info=='s'){
rightServo.write(rightB);
leftServo.write(leftB);
delay(100);
}

//left
if(info=='a'){
rightServo.write(rightF);
leftServo.write(leftB);
delay(100);
}

//right
if(info=='d'){
rightServo.write(rightB);
leftServo.write(leftF);
delay(100);
}

//stop
{
rightServo.write(rightS);
leftServo.write(leftS);

}


}
}"
asked Nov 25, 2013 in XBee Programmable Development by bjf5051 New to the Community (0 points)

Please log in or register to answer this question.

Contact a Digi expert and get started today! CONTACT US
...