Servo.py is not working

This example is supposed to control micro servo motor.

If you want make it work with your ESC + Motor pairs, you should change the code as following:

import sys
import time

import navio.pwm
import navio.util

navio.util.check_apm()

PWM_OUTPUT = 0
SERVO_MIN = 1.250 #ms
ESC_INIT =  1.100 #ms

with navio.pwm.PWM(PWM_OUTPUT) as pwm:
    pwm.set_period(50)
    pwm.enable()

    # initialize ESC: set initial duty_cicle for 3 sec
    for i in range(30):
        pwm.set_duty_cycle(ESC_INIT)
        time.sleep(0.1)

    while (True):
        pwm.set_duty_cycle(SERVO_MIN)
        time.sleep(0.1)

1 Like