Shop OBEX P1 Docs P2 Docs Learn Events
Control two servos from a PC using Basic Stamp 2 — Parallax Forums

Control two servos from a PC using Basic Stamp 2

JesperJesper Posts: 1
edited 2009-05-14 15:49 in BASIC Stamp
Hi

I have a problem I really can´t find any solution for.

The problem is that I would like to control two RC servos from a custom program runing on a PC.
I thought that the Stamp 2 would be very good for this but now am stuck with the issue that while the stamp can control the two servos I can´t get it to be ready to listen to new commands coming over the serial link from the PC.

Does anyone know a way to make the stamp control two servos but at the same time be able to listen for commands?

I have thought about using some other kind of servo controller like the Parallax servo controller but I need the extra features of the stamp to control some LEDs and get input from two home switches.

Any help or examples would be very appreciated!

//Jesper

Comments

  • SRLMSRLM Posts: 5,045
    edited 2009-05-14 15:15
    You could have some sort of RTS type signal. When the computer wants to send data to the BS2, it pulls the line high, then the BS2 checks that and when it's ready pulls it low. The data is then sent. You may also want to consider the Propeller.
  • Beau SchwabeBeau Schwabe Posts: 6,560
    edited 2009-05-14 15:49
    Jesper,

    Here is something that might help... http://forums.parallax.com/showthread.php?p=549166

    There is a QuickBasic program that runs on the PC that talks with the BS2 to control 2 servos and a Laser. Further down in the link, there is a Visual Basic version.

    With the program provided, the BS2 expects a steady serial stream, but if you modify your SERIN command to timeout after 20ms then you don't have to send continuous data.


    change the line of code in the BS2 that looks like this...
    
    SERIN RS232,(10000/(Baud/100))-20,[noparse][[/noparse]WAIT("LPO"),X_Offset,Y_Offset,Lazer]
    
    ... so that it looks like this to implement a timeout...
    
    SERIN RS232,(10000/(Baud/100))-20,20,MainLoop,[noparse][[/noparse]WAIT("LPO"),X_Offset,Y_Offset,Lazer]
    
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
Sign In or Register to comment.