Shop OBEX P1 Docs P2 Docs Learn Events
servo problems — Parallax Forums

servo problems

ajs4ajs4 Posts: 2
edited 2008-06-05 17:48 in BASIC Stamp
I am trying to run a program that is supposed to run the motors for 6 seconds no matter how many pulses the stamp receives. When I send "700" it runs for about 6 seconds; when I send "650" it runs for less than a second.confused.gif

this is the program:
·· FOR counter = 1 TO 244
······ PULSOUT 12, pulseWidth
······ PULSOUT 13, pulseWidthComp
····· ·PAUSE 20
·· NEXT

LOOP



Any ideas?

Thanks.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-06-05 16:44
    You've probably exhausted your batteries. Each loop normally would take 20ms plus pulseWidth plus pulseWidthComp (which you haven't specified). Assuming pulseWidth is around 700, that's 1.4ms with a BS2. If pulseWidthComp is roughly 800, that's 1.6ms for a total of 23ms per loop which comes out to about 5.6 seconds.
  • ajs4ajs4 Posts: 2
    edited 2008-06-05 17:11
    Thank you, Mike. I replaced the 4 1.5V batteries with one 9V battery and it's running faster than ever!




    Thank you again,

    ajs
  • rotary9krotary9k Posts: 26
    edited 2008-06-05 17:48
    This happened to me recently too! I replaced the batteries and BAM, it went so much smoother and faster.

    And thanks for those numbers on execution time for the pulsouts. Now I can actually put some real math into it rather than trial and error.
Sign In or Register to comment.