stepper motor setspeed

The speed is controlled by using the variable i for the set speed of the stepper motor. It is expected to be a problem of speed because the period is not correct when implementing sin wave. I want to convert mm/s to RPM in setspeed and put the value. The conversion process was expressed as RPM → rad/s * angle/rad * mm/angle → mm/s, and converted in the reverse direction. I did this but the linear actuator works out of cycle. I wonder if the conversion process is a mistake.

Do you have a question about some code that you could post ?

I wonder if the conversion process is a mistake.

what distance is "mm" measuring? the circumference of the arc or a straight line distance?

Is it just me, or is about the only piece of advice I can give the OP on their code...
"i" is a very poor choice of variable name for "set speed of the stepper motor"?

Perhaps I'm missing something :wink: