"The function start is not being executed" error when trying to run the same piServoCtl (Raspberry Pi Servo) function multiple times

Viewed 30

Helpful link: https://github.com/naoto64/piServoCtl

The code is copied below:

from piservo import Servo
import time

myservo = Servo(12)

def rotate():
    myservo.write(180)
    time.sleep(1)
    myservo.stop()

rotate() # running the function once works fine
rotate() # trying to run it a second time throws the error: "The function start is not 
being executed"

I'm at a loss as to what to do at this point. I'm using a continuous rotation servo and the above code is the only script I can get to work at this point. The code is somewhat misleading. myservo.write(180) determines the speed of rotation. time.sleep(1) determines the amount of time the servo rotates. The manual for the piServoCtl doesn't define the above functions as doing what is written above, I've just found this through experimentation. Admittedly that doesn't matter, I would just like to be able to call function multiple times. Any help would be greatly appreciated.

0 Answers
Related