I am trying to control my continuous servo motor using this code:
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.OUT)
p = GPIO.PWM(17, 50)
p.start(7.5)
try:
while True:
p.ChangeDutyCycle(7.5)
time.sleep(1)
p.ChangeDutyCycle(12.5)
time.sleep(1)
p.ChangeDutyCycle(2.5)
time.sleep(1)
except KeyboardInterrupt:
GPIO.cleanup()
Servo operates correctly as the code sometimes and other it works randomly for the same code. I use another power source for the motor.
I don't think motor is damaged because I use Arduino to control the servo and it works perfectly.