Can pan/tilt be blocking?

I am testing my pan/tilt shield and have a couple of issues. In the code segment below, I tell it to pan - 5 degrees in 2 seconds and then I read the position.

current_pan = Pan.angle()
print (“Current pan angle is %s” % current_pan)

What happens is that the code does not wait for the servo to get to 5 degrees. It sends the command and then prints the position almost right away.

Question: Can I use a wait or do loop after issuing Pan.angle(-5,2000) to not move forward in the code until the movement is finished?

Just add sleep(2000) after the command.

That does not work.

Why not ?

This code seems to work.

print(“1. Pan angle 0”)


print(“2. Pan angle -10”)

print(“3. Pan angle 10”)

print (“Done”)

For some reason, I have much better success with utime.sleep_ms() than I had with time.sleep().