Shop OBEX P1 Docs P2 Docs Learn Events
Pass command line arguments to Xbee? — Parallax Forums

Pass command line arguments to Xbee?

oZEPPELINooZEPPELINo Posts: 3
edited 2013-03-04 10:52 in Accessories
My setup has an Xbee wireless adapter plugged into my PC via USB and another Xbee running on my Basic Stamp controller. How can I run a program from command line that will program the USB Xbee? This is for an autonomous project that sends a signal to the Basic Stamp which controls a motor. The control information needs to be started via a script. I hope I've explained this well. Feel free to ask any questions and thank you very much!

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2013-03-04 09:55
    It's easiest if you preconfigure both xBees using Digi's utility program so they power on as wireless serial connections. Parallax's "Getting Started ..." text describes how to do this part. Once you plug the USB xBee adapter in, it appears as a COM port (like COM8 or some other number on Windows). This port may change each time you restart your system. You can make the port name a parameter to your script. In any event, you will need some kind of serial terminal program that transmits out that port. If you're using Linux or the Mac OS, you can just use echo or cat to transmit to the COM port device. echo should also work with Windows.
  • oZEPPELINooZEPPELINo Posts: 3
    edited 2013-03-04 10:28
    Thanks for your response, I currently have them set up and communicating through the X-CTU terminal. Currently what I do is assemble a packet and sent it over. Usually it's something simple like "1200" followed by a newline. Is it possible to do this action through traditional Windows command line? The portion of using echo that you mentioned confuses me a bit. Are you saying that I need to connect to the COM port through windows command prompt and then use echo to communicate? If this is the case, where can I learn syntax for this? Thanks again!
  • Mike GreenMike Green Posts: 23,101
    edited 2013-03-04 10:52
    Windows command scripting allows you to redirect standard output to a command specified device. Since the echo command just echos the text on the command line to standard output, you can use that like:

    echo This is some text>COM0:

    This will transmit "This is some text" followed by a carriage return / line feed to device COM0:

    You'll have to look at the Windows scripting documentation for details on options for commands like echo and variable substitution in scripts, etc.
Sign In or Register to comment.