Controlling the BASIC Stamp with C#
manishroy
Posts: 16
How to control the basic stamp 2 using C#?
I want to know how to control a code written in the native code of basic stamp 2 i.e PBASIC using c# or VB.I actually want to create a GUI using VB or C# which will take input from the user and insert that input to the Basic Stamp 2 code and when the code is executed the the arm of the bot will move according to the specified input.How to do it Please help!!!
Post Edited (manishroy) : 9/17/2009 7:44:23 AM GMT
I want to know how to control a code written in the native code of basic stamp 2 i.e PBASIC using c# or VB.I actually want to create a GUI using VB or C# which will take input from the user and insert that input to the Basic Stamp 2 code and when the code is executed the the arm of the bot will move according to the specified input.How to do it Please help!!!
Post Edited (manishroy) : 9/17/2009 7:44:23 AM GMT
Comments
http://forums.parallax.com/showthread.php?p=671804
Jeff T.
Also, please do not post threads without a subject. It makes it harder for people to see what the thread is about and makes it very difficult to search the thread for information.
You essentially have a program on the PC in some language that can handle serial ports (like C# or C++ or VB) and you come up with your own protocol for sending information back and forth. Typically you'd send a delimiter like "!" from the PC followed by a single letter command and perhaps a numeric value terminated by a carriage return. The Stamp program would read this and decode it, then respond in some way. A typical SERIN might look like:
SERIN 16,<Baud>,[noparse][[/noparse]wait("!"),operation,dec operand]
Here "<Baud>" would be the value given in the Stamp Manual for the Baud you're using on the PC. The "wait" causes the SERIN statement to stop until a "!" comes in. The next byte received would go into "operation" and there would be a string of digits after that terminated by a carriage return. The value of the digits would go into "operand".
It would be up to your program to assign operations to various values of "operation" like "A" or "B" or "C", etc. If an operation doesn't need an operand, that can be left out and the carriage return would follow the "operation" character. The value of "operand" in that case would be zero and you could ignore it.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
(kundan lohani)