how to run two or more stepper motor simultaneously (all of different steps)?

I am trying to do a project where i need to move the stepper motors parallely (they are not connected to same driver and of different steps) so i can reduce my overall cycle time

all the suggestions are welcome.

till now am moving one stepper motor at a time
example: xaxis(50);
yaxis(60);
zaxis(80);
i need to be able to move all three independently
ie if i give xaxis(50); it should not be stuck there until it completes but it should move on and do yaxis(60)
and then zaxis(80)
xaxis(50) , yaxis(60),zaxis(80) will be functions with loops that exits out on reaching the position

Is it possible to do it with interrupts?
If so please give me an example

You have not posted the code you have been trying so I don't know what problem you have had.

If you want to move several steppers at the same time at different speeds but WITHOUT the requirement that they all stop at the same time then the process is very straightforward. The simplest thing is probably to use the AccelStepper library which has the non-blocking run() command.

Alternatively write your own code to cause each step to happen after an appropriate amount of time using millis() or micros() to achieve non-blocking timing. See the second example in this Simple Stepper Code

If you want all of the motors to move through different distances in the same time then things are a little more complex. You need to work out the time for the longest move and then allocate step-intervals for all the other motors so that, for example, one motor makes 237 steps in the same time that another makes 1073 steps. The MultiStepper version of AccelStepper can do that for you - but it does not use acceleration.

...R
Stepper Motor Basics

Robin2:
You have not posted the code you have been trying so I don't know what problem you have had.

If you want to move several steppers at the same time at different speeds but WITHOUT the requirement that they all stop at the same time then the process is very straightforward. The simplest thing is probably to use the AccelStepper library which has the non-blocking run() command.

Alternatively write your own code to cause each step to happen after an appropriate amount of time using millis() or micros() to achieve non-blocking timing. See the second example in this Simple Stepper Code

If you want all of the motors to move through different distances in the same time then things are a little more complex. You need to work out the time for the longest move and then allocate step-intervals for all the other motors so that, for example, one motor makes 237 steps in the same time that another makes 1073 steps. The MultiStepper version of AccelStepper can do that for you - but it does not use acceleration.

...R
Stepper Motor Basics

thanks for your reply

I used accelstepper library but it moves only one motor at a time (blocking)

my code

void Xaxis(int X_position) {
stepperX.moveTo(X_position);
}

void Yaxis(int Y_position) {
stepperY.moveTo(Y_position);
}

void gripper_z(int Z_position) {
stepperZ.moveTo(Z_position);
}

my code

That is SOME of your code. So, I'll post SOME of the answer.

What you need to do is really simple. Change to . Hope that helps.

amrithmmh:
I used accelstepper library but it moves only one motor at a time (blocking)

Why are you not using the non-blocking run() function of AccelStepper?

And, as @PaulS has said, always post a complete program.

...R