Shop OBEX P1 Docs P2 Docs Learn Events
Visual Basic and Basic Stamp! — Parallax Forums

Visual Basic and Basic Stamp!

LidemanLideman Posts: 6
edited 2009-08-11 18:13 in BASIC Stamp
Hallo everyone. I'm from Brazil and I need some help. I need a way to make a Visual Basic software that can controls servo motors using Serial port using one Basic Stamp. Is that possible? PLease i try to find a way but it seems impossible.
SO i hope you can help me.
Thanks for reading this.
Best regards for all!!!

Comments

  • dev/nulldev/null Posts: 381
    edited 2009-08-07 14:42
    Here is a quick-start for you.

    - In VB, drop a Serial Port control on your form.
    - In Form_Load type SerialPort1.PortName="COM1", then SerialPort1.Open().
    - To send data, write SerialPort1.Write().
    - Prefix your data from the PC with a "!". For example, type SerialPort1.Write("!750")


    On your Stamp:
    ServoPos VAR Byte(3)
    SERIN port, baud, [noparse][[/noparse]WAIT("!"), str ServoPos\3]

    .. then send ServoPos to your servo.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Don't worry. Be happy
  • LidemanLideman Posts: 6
    edited 2009-08-07 14:46
    dev/null said...
    Here is a quick-start for you.

    - In VB, drop a Serial Port control on your form.
    - In Form_Load type SerialPort1.PortName="COM1", then SerialPort1.Open().
    - To send data, write SerialPort1.Write().
    - Prefix your data from the PC with a "!". For example, type SerialPort1.Write("!750")


    On your Stamp:
    ServoPos VAR Byte(3)
    SERIN port, baud, [noparse][[/noparse]WAIT("!"), str ServoPos\3]

    .. then send ServoPos to your servo.

    Thanks for the aswer, but don't ou have a complete tutorial? I Don't know how to use Visual basic.
    Thanks again.
  • Mike GreenMike Green Posts: 23,101
    edited 2009-08-07 14:50
    It is possible. Other people have made all sorts of Visual Basic to Stamp interfaces. You'll have to learn Visual Basic, particularly the statements that are used for serial ports. On the Stamp end, the SERIN and SEROUT statements are used to receive and send information to a PC. You can use the built-in programming interface for serial data by using either I/O pin #16 or the DEBUGIN and DEBUG statements. Read the Stamp Basic Syntax and Reference Manual for details.

    The main problem you will run into is that the Stamp can only do one thing at a time. When it's listening for data from the PC, it can't produce the servo control pulses needed. You can use either the PWMpal or the ServoPAL to take over the generation of the servo control pulses from the Stamp. The PWMpal has 4 channels (and you can only use one with a Stamp) while the ServoPAL has 2 channels and you can add as many as you need with each ServoPAL using one I/O pin.

    There's no complete tutorial. You may be able to find some examples by browsing back through this forum or the Completed Projects or the Sandbox forums. You will have to learn Visual Basic and Stamp Basic. There's no getting around it.

    Post Edited (Mike Green) : 8/7/2009 2:55:13 PM GMT
  • dev/nulldev/null Posts: 381
    edited 2009-08-07 15:29
    I agree with Mike, there is no way you will get anything working well unless you learn how write code. When you run into specific problems you can post them here. I would encourage you to learn VB and Stamp Basic, as they are by far the easiest program environments you can find. Most people learn the elementary stuff within days. You will find that a simple question like "running a servo" can turn out to be quite complex, depending on how you want to use it, and it's hard if not impossible to answer a question like that unless you have specific details about your project.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Don't worry. Be happy
  • LidemanLideman Posts: 6
    edited 2009-08-07 16:58
    Mike Green said...
    It is possible. Other people have made all sorts of Visual Basic to Stamp interfaces. You'll have to learn Visual Basic, particularly the statements that are used for serial ports. On the Stamp end, the SERIN and SEROUT statements are used to receive and send information to a PC. You can use the built-in programming interface for serial data by using either I/O pin #16 or the DEBUGIN and DEBUG statements. Read the Stamp Basic Syntax and Reference Manual for details.

    The main problem you will run into is that the Stamp can only do one thing at a time. When it's listening for data from the PC, it can't produce the servo control pulses needed. You can use either the PWMpal or the ServoPAL to take over the generation of the servo control pulses from the Stamp. The PWMpal has 4 channels (and you can only use one with a Stamp) while the ServoPAL has 2 channels and you can add as many as you need with each ServoPAL using one I/O pin.

    There's no complete tutorial. You may be able to find some examples by browsing back through this forum or the Completed Projects or the Sandbox forums. You will have to learn Visual Basic and Stamp Basic. There's no getting around it.

    Hi i made some researshs on internet and finaly i discovery a way to creat. I wastrying to use this program and i had sucess. But now i wanna creat my own software like this one in the webpage, how can i make this using visual basic? Thanks again.http://www.rentron.com/servo.htm
  • Mike GreenMike Green Posts: 23,101
    edited 2009-08-07 17:20
    You have to learn Visual Basic. There are lots of books and videos that have been written on that subject. We cannot help you with that.

    The webpage you showed is for a demonstration program. The technique they showed will not work for smooth, continuous servo motion. When the Stamp waits to receive data from the PC, the servo will twitch or slip slightly and that may or may not be acceptable for what you want.

    There is a free program called StampPlotPro available from Parallax (www.parallax.com/tabid/441/Default.aspx) or from the author (www.selmaware.com) that runs on a PC and, in addition to plotting data from the Stamp, allows you to set up controls that the Stamp can "read". You can use this to learn how to communicate between a Stamp and a PC.
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2009-08-08 15:05
    Hi the following link was specifically written with the Stamp in mind and has several simple examples to help get you started.

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

    Jeff T
  • Johnny5Johnny5 Posts: 10
    edited 2009-08-11 18:13
    I used the link that [noparse][[/noparse]Unsoundcode] recommended to get my project rolling. It works very well.
Sign In or Register to comment.