Shop OBEX P1 Docs P2 Docs Learn Events
Programming Toddler servo mini f/bb in C — Parallax Forums

Programming Toddler servo mini f/bb in C

fminafmina Posts: 2
edited 2007-11-20 19:50 in Robotics
Please help.· I need to program a micro to spin this servo CW and CCW.· I figured how to get it to go CCW but not return to the home position CW.· Please help

Comments

  • fminafmina Posts: 2
    edited 2007-11-20 19:28
    To clarify, I need help writing the code in C exactly or in as much detail as possible
  • Mike GreenMike Green Posts: 23,101
    edited 2007-11-20 19:34
    Download the Robotics with the BoeBot tutorial from Parallax's website (see: www.parallax.com/Education/ProductInformation/StampsInClassTutorials/tabid/535/Default.aspx).

    This will give you a general understanding of how servos work and what they need in terms of control pulses.
    Basically, your micro has to produce a logic level pulse about every 20ms with a pulse width between 0.5ms
    and 2.5ms (sometimes only between 1ms and 2ms depending on the servo).
  • Mike GreenMike Green Posts: 23,101
    edited 2007-11-20 19:50
    Although there are some C compilers for the SX processor (see here:http://forums.parallax.com/showthread.php?p=687843), Parallax doesn't support them. You may find library routines that will do the pulse generation for you, but I can't help you. There is a Basic (SX/B) compiler available here for the SX and that has built-in statements for generating the pulses needed to control a servo.

    The Stamps can only be programmed in Parallax Basic and the Propeller currently can only be programmed in Spin and its assembly language.

    Post Edited (Mike Green) : 11/20/2007 7:56:38 PM GMT
Sign In or Register to comment.