Shop OBEX P1 Docs P2 Docs Learn Events
Need help on simple xBee to xBee communications. — Parallax Forums

Need help on simple xBee to xBee communications.

treborz17treborz17 Posts: 76
edited 2011-04-15 04:18 in Accessories
I have the all the latest XBee books including "Getting Started with XB RF Modules" and all the hardware needed for the projects in the books, and have understood most of the projects. I plan to continue working with those projects to further educate myself in the use of the XBee units.

However, in the mean time I have been working on, for most of the last 6 months, a favorite project of assembling propeller software and hardware for my large Robot Base Full kit. Now, I seem to be stumped on what I thought was a simple little XBee project.

I need to send a variable data set from one OBJ method to another and I am having trouble knowing where to start since all the complicated demos in the books seem to include the PC for part of the communications. I need to send from one XBee to another XBee, and nothing else.

Here is where I am: I have working well, a hardwired Joystick to a Motor Control OBJ, and now want to add xbee's to remote the Joystick.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

OBJ

WCtrl : "Wheel_Controller"

PUB MAIN

WCtrl.JoyStick (CH1percent, CH0percent) ' I want to send the two variables to Wheel_Controller OBJ via XBee.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Would appreciate any help in getting started with the XBee progs.

Robert

Comments

  • FranklinFranklin Posts: 4,747
    edited 2011-04-11 20:00
    The easiest way to do this is to format your transmission into an ascii string and send that. On the other end receive the string and parse out the values. You could test this by connecting the two serial ports with wire.
  • treborz17treborz17 Posts: 76
    edited 2011-04-11 22:59
    Do I use a Serial OBJ program to send and recieve the string?

    Robert
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2011-04-14 04:56
    To receive multiple bytes, use and modifiy "Multiple_Decimal_Receive.spin" on Page 65 and modify to exclude the PC communications - simply accept to use your variables without sending it back to base.

    On the transmit side, use similar configuration code, but send data using something like this:
    XB.Tx("!") ' start delimiter
    XB.DEC(value1) ' first value
    XB.TX(",") ' comma separator
    XB.DEC(value2) ' 2nd value
    XB.Tx(13) ' carriage return

    It will send a string such as !10,20 (with CR)

    -Martin
  • treborz17treborz17 Posts: 76
    edited 2011-04-14 07:28
    Thank you Franklin and Martin --

    Martin, I followed the creation of your book on the forum, and should have had taken more time researching my problem before asking for help on such a simplistic problem. As I am celebrating my 81st next month I'm finding my technical aspirations are becoming harder to accomplish. I've been working on the autonomous part of my robot for months and doing pretty good on its development. Its equipt with two way cameras and all ten of the sensors, even though I don't think the ten are necessary but look good, and rudimentary conversational speech. My wife of 60 years and I am hoping we end up with a servant around the house -- like sending the bot to the other room with a tray of goodies, etc..

    Thanks again,

    Robert
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2011-04-15 04:18
    No problem Robert,
    I hope I'm still active in explore new areas at 81!. And yes, There should have been some simple uC to uC examples in the book.

    -Martin
Sign In or Register to comment.