Shop OBEX P1 Docs P2 Docs Learn Events
Demonstration Program for two servo motors — Parallax Forums

Demonstration Program for two servo motors

magicmetalmagicmetal Posts: 3
edited 2010-04-05 18:59 in Robotics
I am not a programmer. Four years ago I built a simple servo motor demo board for my art students using a BASIC STAMP 2 and a UNL2803A ic to drive TWO small mitsumi motors. At the time I downloaded some code that made the motors rotate back and forth and then repeat the motion over and over again. I no longer have that code. Could anyone either write me a simple sketch or direct me to a site that has some sample code that I could download. Here is an attachment with a image of my board.
226 x 128 - 9K

Comments

  • Martin_HMartin_H Posts: 4,051
    edited 2010-04-05 11:09
    I can't help with code to control that IC, but if you replaced the motors with continuous rotation servos (they're about $12) you could use code off the internet.

    For example this link shows how to control a servo using a pot with the basic stamp. Not quite what you are looking for, but perhaps better:

    http://www.parallax.com/dl/docs/books/sw/exp/sw25.pdf
    Also, the code inside this zip file off the internet archive of the CBA robot site:

    http://web.archive.org/web/20060621075149/budgetbot.com/downloads/BS2e/CBA_Testing.zip

    Contains the following test code for their basic stamp 2e, but it should be adaptable for your board:

    '{$STAMP BS2e}
    '{$PBASIC 2.5}
    PulseWidth VAR Word
    DO
    FOR PulseWidth = 500 TO 1000 STEP 2
    ·· PULSOUT 12,PulseWidth
    ·· PULSOUT 13,PulseWidth
    ·· PAUSE 20
    NEXT
    FOR PulseWidth = 1000 TO 500 STEP 2
    ·· PULSOUT 12,PulseWidth
    ·· PULSOUT 13,PulseWidth
    ·· PAUSE 20
    NEXT
    LOOP

    Post Edited (Martin_H) : 4/5/2010 11:31:19 AM GMT
  • Martin_HMartin_H Posts: 4,051
    edited 2010-04-05 11:34
    Also, the picture is too small to see much detail. But those look like stepper motors not servo motors as you say in the text. If you want to stick with those we would need more details about them.
  • hover1hover1 Posts: 1,929
    edited 2010-04-05 11:41
    It looks like they may be the stepper motors that parallax sells. Documentation and sample code is on the bottom right of this pages:

    ·http://www.parallax.com/StoreSearchResults/tabid/768/txtSearch/stepper/List/0/SortField/4/ProductID/65/Default.aspx

    Jim
  • magicmetalmagicmetal Posts: 3
    edited 2010-04-05 18:52
    My intent with my students is to demonstrate the programmable functions of 3 different motors types. Servo, Stepper and Variable Speed DC motors. I built three demo boards and the only one I am having trouble with is the two stepper motor set up with the ULH2803a ic/
    so any code that would work with a BS2, two stepper motors and a uhl2803 ic would be greatly appreciated.
    Thanks,

    Ira
  • FranklinFranklin Posts: 4,747
    edited 2010-04-05 18:59
    Ira, Check out the post directly above your last post (hover1)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
Sign In or Register to comment.