How would I send commands/programs to BS2 from other programming languages like C/C++
naspipper
Posts: 3
Hello everyone,
I'm developing a system that needs to be able to communicate a robot wirelessly. I'm going to use the XBee BS2 flashfly kit. I'm wondering if there is a way to send commands/programs to the BS2 autonomously without me typing the program on the BS2 editor, because I'll be using C/C++ or Matlab for programming. Is there a way to do this directly from this programming languages?
I'm developing a system that needs to be able to communicate a robot wirelessly. I'm going to use the XBee BS2 flashfly kit. I'm wondering if there is a way to send commands/programs to the BS2 autonomously without me typing the program on the BS2 editor, because I'll be using C/C++ or Matlab for programming. Is there a way to do this directly from this programming languages?
Comments
Usually, a Stamp might be controlled by a PC program, but not necessarily reprogrammed by it. The PC program opens a standard serial port and communicates with the Stamp program via SERIN and SEROUT statements using some protocol that you specify. Look at the Propeller Servo Controller for one example of how this is done (in this case with the Stamp controlling another device ... the Servo Controller).
I have gone through the tokenizer documentation, and it sounds confusing and too complex for a beginner like me. I was wondering if there are specific examples of using the tokenizer with C.
May be the other alternative, using SERIN and SEROUT, would be easier for me.
*I think my problem is easier than I make it seem, or I might easily get help if I explain it better.
Here it is:
I'm using a program (will most likely be in C) that will need to periodically download new program to the robot's BS2 controlling a robot.I have attached an exact sample of the program (written in Basic Stamp Editor), throughout the process only parts/variables of this code will be altered, the variables below
a(0) = %0000011010010110 ^ %0000110011001100
a(1) = %0000010000010100 ^ %0000110011001100
a(2) = %0000100101101001 ^ %0000110011001100
a(3) = %0000000101000001 ^ %0000110011001100
r(0) = 15
r(1) = 14
r(2) = 15
r(3) = 14
and then the modified program will be downloaded again to the BS2 and see how the changes do on the robot.
Hoping that I made this clearer, how would I go about doing this via SERIN and SEROUT or tokenizer in C?
On the PC side, send the attention character and listen until the "I'm ready" character is returned from the STAMP. Then send your 12 bytes of data, log it, and exit.
The STAMP can only do one thing at a time; listen or execute the loop.
See the STAMP manual for more information and examples using the SERIN and SEROUT commands.
'
Take a look in the Basic Stamp Manuel on how to do this. ( PIN 16 )-(SERIN)-(SEROUT)-(WRITE)-(READ)
'
Its pretty simple once you see how it works.
'
Pin 16 is the programming pin and also the DEBUG serial link back to the PC.
'
Basic Stamp Manuel (link below ) The download is free))
http://www.parallax.com/Store/Books/BASICStamp/tabid/168/CategoryID/42/List/0/SortField/0/Level/a/ProductID/143/Default.aspx