Go Down

Topic: Delays between servo movements in pyfirmata don't work (Read 183 times) previous topic - next topic

Divdav419

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.

Code: [Select]
from pyfirmata import Arduino, 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


Code: [Select]
from pyfirmata import Arduino, 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

Go Up