Navio2 - servo

Adsız

Hello guys,
I get this error when I want to run the servo on navio2, can you help me?
My python code is as follows:
import sys
import time

import navio.pwm
import navio.util

navio.util.check_apm()

PWM_OUTPUT = 0
SERVO_MIN = 1.250 #ms
SERVO_MAX = 1.750 #ms

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

while (True):
    pwm.set_duty_cycle(SERVO_MIN)
    time.sleep(1)
    pwm.set_duty_cycle(SERVO_MAX)
    time.sleep(1)

Hi @zelikerdem.01,

It seems that your script can’t find the local Python module. You can try running the script inside the Navio2 Python examples folder. There is a folder called navio with pwm.py file inside. Your script needs it for importing.

3 Likes

thank youu :slight_smile:

1 Like