I created a program to run a stepper motor with decreasing delays between each step and ends once a value is reached. My problem is that I had to plug in a bunch of numbers until I found a value that matched a desired number of steps the motor took. I was hoping some could help me calculate the value without needing to guess.
Below is the Python code I am using to have my stepper motor reach 2500 steps.
delay = 0.01
final_delay = 0.00001
while final_delay < delay:
delay = delay - (dealy/362.412)
The value of "362.412" is the one I refined until this loop completed 2500 steps. How can I find this value without needing to plug in numbers until I reach a desired number of steps?
Thank you for reading this, and any feedback or suggestions you give.
Note that the last line of the loop could be written as
so that we want to multiply $.01$ by some number $p$, $2500$ times until we get to $.00001$ $$.01\cdot p^{2500}=.00001\\ p=.001^{1/2500}\\ p=0.9972407117415495 $$ Now if you solve $$p=1-\frac1q$$ you'll get $$q=362.4122985111945$$