Shop OBEX P1 Docs P2 Docs Learn Events
Servo Control using SX/B — Parallax Forums

Servo Control using SX/B

Lmiller1708Lmiller1708 Posts: 12
edited 2007-02-23 13:46 in General Discussion
What is the best way to control servos?

I'm also using IR sensors.

Thanks,
Lance

Comments

  • BeanBean Posts: 8,129
    edited 2007-02-21 00:52
    Use the PULSOUT command.

    Bean.

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

    Low power SD Data Logger www.sddatalogger.com
    SX-Video Display Modules www.sxvm.com
    Stuff I'm selling on ebay http://search.ebay.com/_W0QQsassZhittconsultingQQhtZ-1

    "USA Today has come out with a new survey - apparently, three out of every four people make up 75% of the population." - David Letterman
  • JonnyMacJonnyMac Posts: 9,283
    edited 2007-02-21 02:18
    Bean's right, PULSOUT is easiest. If you happen to need "background" servo control, you can do it with an interrupt-driven virtual serial controller. See this thread:

    http://forums.parallax.com/showthread.php?p=630664
  • Lmiller1708Lmiller1708 Posts: 12
    edited 2007-02-21 04:18
    Thanks Guys,
    Like I said before, I will be using IR sensors also.
    Right now I'm using the Interrupt to run them.
    So I ask another question, Which way is going to be better for my purpose?
    Which is to make a robot follow a black line with some line sensors from parallax and have a couple of aux outputs.
    I'm really new at this, and would like the code to be as simple as possible.
    Thanks again,
    Lance
  • JonnyMacJonnyMac Posts: 9,283
    edited 2007-02-21 05:51
    "Simple" is a very subjective word. I think the ISR code is simple but then, I wrote it and have a bit of practice. The "problem" with servos is that they require refreshing and this can be bothersome for a straight-line program -- like we're forced to do with the BASIC Stamp.

    I updated my servo program to modulate an IR LED in the ISR and work with just two servos; this should get you going. Your control program can focus on setting servo speed and looking at sensors; the ISR will handle the LED modulation and servo refreshing. If you decide to add another servo you can without expanding the code -- simple adjustments are all that's required to let it handle up to eight servos.

    Good luck.
  • Lmiller1708Lmiller1708 Posts: 12
    edited 2007-02-21 19:26
    Thanks JonnyMac!!

    Lance
  • Capt. QuirkCapt. Quirk Posts: 872
    edited 2007-02-23 08:14
    "bothersome" is right, I find it amazing that you can handle up to 8 servos on 1 SX chip or 4 triggers, 8 outs, 4 servos. The SX-Creeper is another amazing project too. It blows my mind that you can do all that and I can't control· a single·Futaba servo and take in inputs from 0831 ADC, an RC Circuit, a Count routine that keeps track of 230 pulses/sec and a master contol routine on a single SX, without using up all my variable space or blowing timming of 1 or all the componets I am trying to use together.

    Your Code example has several routines that look like they prevent routines from running over the top of each other. Could you post (if possible) a flow chart of how that "Prop484-EZ.SXB" works.

    Thanks
  • JonnyMacJonnyMac Posts: 9,283
    edited 2007-02-23 13:46
    Between Halloween industry trade show travels and trying to finish "Practical SX/B" I really don't have time to provide an elaborate explanation here. That code will be fully detailed in the book, however. And... I think if you spend a little time with the code you'll see that it's actually quite easy.
Sign In or Register to comment.