title: Control continuous servo motor with Raspberry Pi and Python
body: <p>I am trying to control my continuous servo motor using this code:</p>
  
  <pre><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()
  </code></pre>
  
  <p>Servo operates correctly as the code sometimes and other it works randomly for the same code. I use another power source for the motor.</p>
  
  <p>I don't think motor is damaged because I use Arduino to control the servo and it works perfectly.</p>