Shop OBEX P1 Docs P2 Docs Learn Events
Controlling servos with a pot — Parallax Forums

Controlling servos with a pot

GrampsGramps Posts: 117
edited 2010-04-21 19:15 in BASIC Stamp
I’m working on “servo control with a pot” on page 158 WAM.
The demo moves the servo about 45 degrees when the pot is moved 90 degrees. How do you match them so they both move together from 0 to 90?

Post Edited By Moderator (Joshua Donelson (Parallax)) : 4/21/2010 12:20:05 AM GMT

Comments

  • JDJD Posts: 570
    edited 2010-04-21 00:27
    Gramps,

    · You can include another servo by adding a PULSOUT command under the first command. You would have to provide another pin to pulse on, but the time that is used in the first PULSOUT could be used in the second PULSOUT for the same motion.

    :: Code Snippet ::
    · PULSOUT ServoPin, time
    · PUSLOUT ServoPin2, time

    Be sure to declare the new ServoPin2 at the top of the program, otherwise you will get a syntax error.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Respectfully,


    Joshua Donelson
    www.parallax.com
  • ercoerco Posts: 20,256
    edited 2010-04-21 04:07
    Scale the pot values read to give you a bigger pulsout range to the servo; you'll have to do some math fudging, slope-intercept type stuff, but basically you'll keep your servo pulsout centered at 1500 and go bigger and smaller. Try less than 1000 and more than 2000, most servos can be overdriven a bit before they hit end stops.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2010-04-21 19:15
    This thread seems to be cross-posted. Please post in only one forum for a particular message.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Parallax Engineering
    ·
Sign In or Register to comment.