Shop OBEX P1 Docs P2 Docs Learn Events
Servo Control — Parallax Forums

Servo Control

bennettdanbennettdan Posts: 614
edited 2006-07-19 15:12 in General Discussion
Hello,
···· I would like to if the SX chips are·able to control a servo with a pot? I·usually use the BS2 for most projects but I am going to buy this ·http://www.parallax.com/detail.asp?product_id=45181·SX tool kit would this provide a good·start? Thanks for any advice..·

Comments

  • BeanBean Posts: 8,129
    edited 2006-07-19 01:34
    Sure, just use the PULSOUT command.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com

    "Remember, you are unique, just like everyone else." Unknown.
    ·
  • bennettdanbennettdan Posts: 614
    edited 2006-07-19 11:46
    But the timing will be different than the BS2 if I clock the SX faster right?
  • BeanBean Posts: 8,129
    edited 2006-07-19 12:35
    If you use SX/B, the compiler will adjust the timing for you.
    The PULSOUT command has 10uSec resolution not matter what the clock speed.
    So "PULSOUT Servo, 150" will generate a 1.5mSec pulse which should center the servo.

    DO
    · PULSOUT Servo, 150
    · PAUSE 20
    LOOP

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com

    "Remember, you are unique, just like everyone else." Unknown.
    ·
  • bennettdanbennettdan Posts: 614
    edited 2006-07-19 14:26
    Thanks bean
    Does the SX use RCtime to read a pot or some other command I cant seem to find it in the manual..
  • BeanBean Posts: 8,129
    edited 2006-07-19 15:04
    Yep,
    SX/B has the RCTIME command.
    There isn't a manual for SX/B (that I know of).
    The help file has all the commands and examples in it.
    From the IDE choose "HELP" from the top menu then choose "SX/B HELP"

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com

    "Remember, you are unique, just like everyone else." Unknown.
    ·
  • John R.John R. Posts: 1,376
    edited 2006-07-19 15:11
    Also note that when you add the code to read the pot (or otherwise determine the servo setting), you may need to reduce the time in the pause command so that you still get a servo pulse every 20 ms or so. If you go too long in between pauses, and you have external forces on the servo, you may get some "humming".

    From a practical standpoint, your routine in the loop would have to get pretty long before the servo has enough time to drift very far. I also belive this "problem" is gone if you use "digital" servos.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    John R.

    8 + 8 = 10
  • bennettdanbennettdan Posts: 614
    edited 2006-07-19 15:12
    I was looking in the manual...
    http://www.parallax.com/dl/docs/prod/sx/SXKeyMan2_0.pdf
    Sorry
Sign In or Register to comment.