The problem I am facing is that I am able to rotate servo motor to the desired position with my code, but I am unable to control the speed of rotation. I need to slow down the rotation so that it slowly rotates from one position to another. Also there is some jitter when the servo moves to a particular position.
I am using 180 degree positional servo.
The following is the code snippet.
Code: Select all
P.start (2.5) #giving PWM signal in pin P
def servo_motion ():
try:
while True:
if GPIO.event_detected (Pin1):
P.ChangeDutyCycle (7.5)
time.sleep (0.2)
time.sleep (0.1)
except KeyboardInterrupt :
P.stop ()
GPIO.cleanup ()
servo_motion ()
Sorry for the indentation problems. I wrote the code from my cellphone.
Can anyone help me in this code to slow down the servo rotation ??? Thanks in advance.