I'm using an rPi to send a GPIO signal to a servo motor. When I run the program, the motor starts turning, and then continues without stopping, even if the program has terminated through the use of a loop or through Ctrl+C. I am not sure why the motor would still be getting signaled to rotate. If anyone has any ideas I would appreciate it! Code here:
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD)
GPIO.setup(11, GPIO.OUT)
p.GPIO.PWM(11, 50)
p.start(7.5)
try:
while True:
p.ChangeDutyCycle(7.5)
time.sleep(10)
p.ChangeDutyCycle(17.5)
time.sleep(10)
print "running"
except KeyboardInterrupt:
p.stop()
GPIO.cleanup()
p
never seems to be set. Is this all of your code, or did you edit something out?