Delays between servo movements in pyfirmata don't work

I’m writing a program in python where moving servos at specific times is a crucial part of the project. To achive this, I am using the pyfirmata library.

I’ve tried two methods of delays, but none of them seem to work. When I run the code, the servo turns the first time, but after the delay, it doesn’t turn and the program just stops, instead of moving the servo to 0 degrees and then stopping.

This is the one with the board.pass_time() built in to the pyfirmata library:

from pyfirmata importArduino, util  
import time board =Arduino('COM3')  
servo = board.get\_pin('d:9:s')  
servo.write(180)#This works and turns the servo  
time.sleep(1)  
servo.write(0)#This time the servo does not turn, then the program ends

And here’s the one with time.sleep():

from pyfirmata importArduino, util board =Arduino('COM3')  
servo = board.get\_pin('d:9:s')  
servo.write(180)#This works and turns the servo  
board.pass\_time(1)  
servo.write(0)#This time the servo does not turn, then the program ends

I would highly appreciate if someone could help.

Thank you, David

This post was moved to a different board that fits your topic of discussion a bit better. This means you’ll get better engagement on your post, and it keeps our community organized so users can more easily find information.

As you’ll notice, your topic is now here in the Project Development Help and Advice board. No action is needed on your part; you can continue the conversation as normal here.