How to drive my servo with servo lib

Issue #458 resolved
Tom Ming created an issue

Hi @John Maloney ,I have a servo,it works with frequency 50Hz (period 20MS) and using pulse width 0.5MS - 2.5MS to rotate it 0 -300 degrees. How could I control it with MicroBlcoks servo lib.Thanks.

Comments (10)

  1. Tom Ming reporter

    Now I can rotate it, but I can not change it’s rotation speed with the servo speed block. How can I change rotating speed.Thanks.

  2. John Maloney repo owner

    Hi, Tom. Glad you figured out how to control the servo angle.

    There are two types of servos. An angle (or "position") servo can be moved to a specific angle. It moves as fast as it an then stops when it reaches the desired anagle.

    A"continuous rotation" servo is like a motor: it turns continuously at a speed based on the parameter. Negative values make it turn in the opposite direction.

    The two types of servos use exactly the same control signal (frequency 50Hz (period 20MS) and using pulse width 0.5MS - 2.5MS) but interpret the pulse width in different ways: as a angle for the position servo and as a power level for the continuous rotation servo.

    You can control the speed of a rotation servo by breaking the total turn angle into a bunch of smaller angles and moving to each intermediate position in a loop, using a "wait" block to get the desired speed.

  3. Log in to comment