Shop OBEX P1 Docs P2 Docs Learn Events
Confusion about using the servo — Parallax Forums

Confusion about using the servo

edited 2008-05-21 01:21 in BASIC Stamp
Hi all-

Okay, I apologize if this is a really stupid question, but I've been reading the book and I can't find out why this is happening:

I am going through the "What's a Microcontroller?" book with my Board of Education Rev C system and the standard Basic stamp (I bought everything as a single product...don't remember what the product itself is called). It came with the Parallax servo and I'm in chapter 4 (Controlling Motion) and the book tells me to, on page 115, enter a program that turns the servo on 3 times in different directions for different times. This works fine. Every time.

As I've been going along, I've been tweaking the programs here and there for experimental purposes (hey, that's what the thing is for, right? turn.gif) so on a lark I simply cut out the part that spins the servo the longest and put it in its own file:

' {$STAMP BS2}
' {$PBASIC 2.5}
counter VAR Word    
FOR counter = 1 TO 150
  PULSOUT 14, 500
  PAUSE 20
NEXT




When I run it on the stamp, it runs the first time, but subsequent runs do nothing. I have an LED attached per the instructions for the other program and it lights up, but the servo never turns. I run the original program and it works perfectly. I go back to my program and it doesn't do anything (short of turning on the LED).

Clearly I'm missing something here, and I can't seem to find in the book where it's obvious what I'm doing wrong. I've studied pages 116 and 117 over and over and it still seems to me that I should be able to spin the servo again and again with the program above, yet obviously this isn't the case.

Can anyone explain to me what I'm doing wrong so that I can finally "get" how to use the servo properly? shakehead.gif

Comments

  • FireHopperFireHopper Posts: 180
    edited 2008-05-21 00:36
    the servo has moved the first time right? a servo is a position motor.. Not a constant run one..

    if you turn it after the program stops and run it again, it should turn again..
    to have it move to a different point.. change the 500 number.

    thats how you get it to move.
  • edited 2008-05-21 00:43
    Oh...so if I understand, the servo works like a clock, and 500 means, essentially "move to the 3 o'clock position from wherever you are", which means that subsequent runs of the same program doesn't work...it's already at the 3 o'clock position. And you're right, changing the number always makes it work.

    Do I have that right? If so, is it that I confused the servo with something like a stepper motor in my thinking of how long to have the thing on?

    Thanks a lot for the reply,

    Ilford
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2008-05-21 00:55
    There is a "standard servo", what's been described, and there's a "continuous rotation servo", which is a modified "standard servo."· A continuous servo will keep going round.
  • FireHopperFireHopper Posts: 180
    edited 2008-05-21 01:10
    ilford_cannondale said...
    Oh...so if I understand, the servo works like a clock, and 500 means, essentially "move to the 3 o'clock position from wherever you are", which means that subsequent runs of the same program doesn't work...it's already at the 3 o'clock position. And you're right, changing the number always makes it work.

    Do I have that right? If so, is it that I confused the servo with something like a stepper motor in my thinking of how long to have the thing on?

    Thanks a lot for the reply,

    Ilford
    yes! you got it.. and as the next post shows.. there are servos modified to keep turning.. those work a bit differently
    ·
  • edited 2008-05-21 01:14
    Wonderful! roll.gif

    Thanks a lot, now it's all clear to me and I can keep going with a little more understanding!
  • FireHopperFireHopper Posts: 180
    edited 2008-05-21 01:21
    I know a bit about servos.. since I'm into animatronics.. and I use em in my costume.. running on a basic stamp 2 [noparse]:)[/noparse]

    its in the completed projects forum [noparse]:)[/noparse]
Sign In or Register to comment.