Is there any way to speed up setTargetPosition?

Comments & issues
Fresh meat
Posts: 4
Joined: Fri Mar 27, 2020 7:23 pm

Is there any way to speed up setTargetPosition?

Postby josh.williams » Fri Mar 27, 2020 7:30 pm

Hi all,

I have a segment of code in python 3.7 that I'm trying to run on a timer that includes:

Code: Select all


From timing my code, it looks like these two lines take about 0.04 seconds to run.

I'd like to run this code on a timer every 0.01 second. Does anyone know of a way to do so? Is it possible to actually change the target position of my stepper every 0.01 second?

I've played around with

Code: Select all

a little bit but don't really understand what it's doing nor have been able to get my code to run.


User avatar
Site Admin
Posts: 769
Joined: Fri Oct 28, 2011 12:17 pm

Re: Is there any way to speed up setTargetPosition?

Postby mparadis » Fri Mar 27, 2020 9:06 pm

The async version of the function is non-blocking so it should run a bit faster because both steppers are being set simultaneously. I'm not sure why it's not working for you. Whether your motor can physically respond to changes every 0.01s though is another matter since it takes time to change direction.

Return to “General”

Who is online

Users browsing this forum: No registered users and 1 guest