Thanks John, I had to wiggle the % around. I think I ended up with 10 and 3, but it spins the same speed both ways. Thanks :)

On 19/01/16 19:18, John Duncan wrote:
You have a cycle that is 21.7ms (t) in length, with 1.7ms on and 20ms off. The frequency is 1/t or 46Hz. The duty cycle is the amount of time on divided by the length of the cycle, 1.7/21.7 or 8%. I'm rounding to the nearest integers.

On Tue, Jan 19, 2016 at 1:53 PM, Jake < <>> wrote:

    I can't test those numbers as I don't have a power supply at home.
    I'm curious how your work out hte duty cycle as a percentage?

    On 19/01/16 18:32, John Duncan wrote:
    Just a guess, you probably need to consider the whole 21.7ms or
    21.3ms to be your period (46Hz or 47Hz) and then your duty cycle
    will be 8% or 6% respectively.

    On Tue, Jan 19, 2016 at 10:32 AM, J B <
    <>> wrote:

        I'm trying to use the PWM module to control a parallax servo
        I purchased. I'm trying to get it to spin both ways as I need
        it for a project, I have tried to spin the servo both
        clockwise and anti clockwise but I do not know how to set a
        20ms gap between each pulse, I need 1.7ms to go anti
        clockwise with a 20ms gap and 1.3ms with a 20ms gap to spin
        clockwise. I've converted the ms into frequency but it
        doesn't change the direction. When I plug the data cable into
        any pin on the entire board the servo spins clockwise, even
        when plugged into PWM0 and (pwm-stop 0) being called.

        On another point is there a dedicated ground pin? I plugged
        the PWM0 port into an oscilloscope and it was littered with
        static, according to my electrical engineering tutor there is
        a bad ground and I need to earth it.

        Another another point, my LCD display still doesn't work and
        I don't know what to do about it.

        The attachment is a datasheet for the servo I bought.

-- John Duncan

John Duncan

Reply via email to