Shop OBEX P1 Docs P2 Docs Learn Events
Controlling the BASIC Stamp with C# — Parallax Forums

Controlling the BASIC Stamp with C#

manishroymanishroy Posts: 16
edited 2009-10-08 14:53 in BASIC Stamp
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

Comments

  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2009-09-14 22:24
    Hi , the following link might help some.

    http://forums.parallax.com/showthread.php?p=671804

    Jeff T.
  • Mike GreenMike Green Posts: 23,101
    edited 2009-09-14 22:42
    DO NOT post multiple messages on the same question. It's against forum rules.

    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.
  • Mike GreenMike Green Posts: 23,101
    edited 2009-09-14 22:52
    A Basic Stamp normally communicates with a PC using a serial port that's usually used for downloading programs. Look at the description of the DEBUG and DEBUGIN statements in the Basic Stamp Syntax and Reference Manual. Also look at the explanation in the chapters on the SERIN and SEROUT statements on the use of pin #16 which also uses the download serial port.

    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.
  • FranklinFranklin Posts: 4,747
    edited 2009-09-15 02:29
    First, go delete your two other posts with the red X in the upper right corner of the post then come back here and add a subject with the pencil icon in the upper right of this post.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • kundan lohanikundan lohani Posts: 1
    edited 2009-10-08 14:45
    hiii i m doing project on vb..which take input from user in vb and that input is inserted on basic stamp2 code.our main view is to rotate servo motor through vb via basic stamp2..my vb code is working fine and this communicate with basic stamp but our servo motor is not rotating..i want to rotate servo via port not through pin..pls help me for this..
    (kundan lohani)
  • Mike GreenMike Green Posts: 23,101
    edited 2009-10-08 14:53
    You need to provide more information. Please provide a schematic or at least a description of how everything is connected. Also provide your Stamp code (as an attachment to your message ... not cut and paste). Use the "Post Reply" button to use the Attachment Manager. If you VB code is short, attach that as well. If it's long and complex, provide a description of what's sent between the Stamp and the VB program.
Sign In or Register to comment.