PDA

View Full Version : Arbotix simple 2-way communication?



Migs
11-29-2009, 03:45 PM
Friends:

Does anyone have code that demonstrates using the Arbotix board XBEEs in communication with the Serial Monitor?

I have downloaded sketches to the board so I know it is set up properly, but now I want to test the XBEE operation. (Am I the only one out there that isn't looking at PyPose?)

Ideally I would like to send something via the Serial Monitor to the board while it is running and cause an effect which would return information back to the serial monitor to me. All via XBEE's of course.

I'm not quite sure, but are the XBEEs supposed to be like a USB connection on a regular Arduino when running properly? If so, I must be doing something wrong because sketches like the one below return nothing to my serial monitor once downloaded to the Arbotix board. (Yes, I remove the ISP programmer and plug in the XBEE receiver to my laptop's USB port.)



void setup()
{
Serial.begin(9600);
}
void loop()
{
Serial.println("Hello World!");
delay(1000);
}

Thanks for your input all!

-Migs

lnxfergy
11-29-2009, 04:03 PM
Yes, the XBEEs are just like the USB connection on a regular Arduino. As for your sketch not working, what's the baud rate for your XBEEs? The XBEEs have to match the serial port. If your following our documentation for PyPose, or ordered a starter kit, your XBEEs are probably at 38400, not 9600.

-Fergs

JonHylands
11-29-2009, 05:42 PM
I do this all the time from my Arbotix on Roz... You have to set up the XBees to talk to each other, and set the baud rate correctly (38,400), and it works great.

- Jon

lnxfergy
11-29-2009, 05:53 PM
Yeah, Jon, I'm almost certain here that the issue is a mismatch of XBEE-baudrate and Arduino baudrate. (or that the XBEEs aren't paired correctly)

-Fergs

Suicidal.Banana
11-30-2009, 10:02 AM
Migs, you can change the baud rate of our xbee's using X-CTU (google it)
Check out this tutorial for more info: XBEE Basics (tut by Inxfergy, see section 'Using the MaxStream Software') (http://forums.trossenrobotics.com/tutorials/how-to-diy-128/xbee-basics-3259/?catid=searchresults&searchid=3067)

An no, your not the only one :)

Migs
11-30-2009, 10:53 AM
Hi All! I don't really know what happened, but it works now. I went into X-CTU and checked all values. They were OK. The only difference seems to be that XBEE A was on the explorer and XBEE B was on the Arbotix. After checking them XBEE B was on the explorer and XBEE A was on the Arbotix.

Running this program helped to verify the XBEEs were talking:



// this is where we will put our data
int myData = 0;
void setup()
{
//start up our serial port, we configured our XBEE devices for 38400 bps.
Serial.begin(38400);
}
void loop()
{
// handle serial data, if any
if(Serial.available() > 0)
{
myData = Serial.read();
if(myData == '\n')
Serial.print(myData,BYTE);
else
Serial.print(myData + 1,BYTE);
}
}
Thanks a million for you all's help,

Migs