Running 2 steppers at the same time but not simultaneously

Hi everyone,

What i am trying to do is to control 2 stepper motor to make them move at the same time. The first should run for a specific number of steps, the second should move only when the first reachs specifics steps.

Basically the movement should be like this:

First motor makes 1512 steps, then, without stopping the second makes 88 steps and it stops.
When the first motor reachs 3112 steps the second motor should do another 88 steps

and so on with those step number as Second motor starting point:

1512 - 3112 - 4712 - 6312 - 7912 - 9512 - 11112 - 12712 - 14312 - 15912 - 17512 - 19112 - 20712 - 22312 - 23912 - 25512 - 27112 - 28712 - 30312 - 31912

then when the first motor have done 35122 steps the second should do the same as before, but counterclockwise so when the first reachs a number of steps the second go CCW of 88 steps

and those are the first motor starting steps for the ccw movement of the second:

35112 - 36712 - 38312 - 39912- 41512 - 43112 - 44712 - 46312 - 47912 - 49512 - 51112 - 52712 - 54312 - 55912 - 57512 - 59112 - 60712 - 62312 - 63912 - 65512

Those 2 sequences should be repeted 6 times.

I am not asking for the entire code, of course, but if you can show me the method to preoceed i will appreciate a lot!

Thank you (:

You have not posted the program you have been trying so I don't know what changes to recommend.

If you are using the regular Stepper library then it is really only designed to run one motor at a time as it blocks the Arduino until a move is complete Of course you could use the library just to do single steps and supply the iner-step timing yourself.

Have a look at the AccelStepper library. It can move the motors without blocking.

...R
Stepper Motor Basics
Simple Stepper Code

So, count the steps of the first motor (call it motor A) and call it stepsA. Whenever (stepsA + 88) % 1600 == 0, fire up motor B for 88 step with dir == CW. When (stepsA + 88) / 1600 == 20, change direction of motor B to CCW. Continue until (stepsA + 88) / 1600 == 41, allow motor B to run its final 88 steps CCW, change direction to CW, reset stepsA to zero, increment the loop counter and do it all over again until the loop counter indicates that you've completed six.

This sound about right?

Robin2:
You have not posted the program you have been trying so I don’t know what changes to recommend.

If you are using the regular Stepper library then it is really only designed to run one motor at a time as it blocks the Arduino until a move is complete Of course you could use the library just to do single steps and supply the iner-step timing yourself.

Have a look at the AccelStepper library. It can move the motors without blocking.

…R
Stepper Motor Basics
Simple Stepper Code

Thank you for your reply.
This is the program i am actually using:

#define EN        8  

//Direction pin
#define X_DIR     5 
#define Y_DIR     6
#define Z_DIR     7

//Step pin
#define X_STP     2
#define Y_STP     3 
#define Z_STP     4 


//DRV8825
int delayTime=200; //Delay between each pause (uS)
int Xstps=1600;       //X movement
int Ystps=88;          //Y movement


void step(boolean dir, byte dirPin, byte stepperPin, int steps)

{

digitalWrite(dirPin, dir);

delay(50);

for (int i = 0; i < steps; i++) {

  digitalWrite(stepperPin, HIGH);

  delayMicroseconds(delayTime); 

  digitalWrite(stepperPin, LOW);

  delayMicroseconds(delayTime); 

}

}

void setup(){

pinMode(X_DIR, OUTPUT); pinMode(X_STP, OUTPUT);

pinMode(Y_DIR, OUTPUT); pinMode(Y_STP, OUTPUT);

pinMode(Z_DIR, OUTPUT); pinMode(Z_STP, OUTPUT);

pinMode(EN, OUTPUT);

digitalWrite(EN, LOW);

}

void loop(){

//Layer 1/12
step(false, X_DIR, X_STP, Xstps); //X, Clockwise
delay(10);
step(true, Y_DIR, Y_STP, Ystps); //Y, Counterclockwise
delay(10);
step(false, X_DIR, X_STP, Xstps); //X, Clockwise
delay(10);
step(true, Y_DIR, Y_STP, Ystps); //Y, Counterclockwise
delay(10);
step(false, X_DIR, X_STP, Xstps); //X, Clockwise
delay(10);
step(true, Y_DIR, Y_STP, Ystps); //Y, Counterclockwise
delay(10);
step(false, X_DIR, X_STP, Xstps); //X, Clockwise
delay(10);
step(true, Y_DIR, Y_STP, Ystps); //Y, Counterclockwise
delay(10);
step(false, X_DIR, X_STP, Xstps); //X, Clockwise
delay(10);
step(true, Y_DIR, Y_STP, Ystps); //Y, Counterclockwise
delay(10);
step(false, X_DIR, X_STP, Xstps); //X, Clockwise
delay(10);
step(true, Y_DIR, Y_STP, Ystps); //Y, Counterclockwise
delay(10);
step(false, X_DIR, X_STP, Xstps); //X, Clockwise
delay(10);
step(true, Y_DIR, Y_STP, Ystps); //Y, Counterclockwise
delay(10);
step(false, X_DIR, X_STP, Xstps); //X, Clockwise
delay(10);
step(true, Y_DIR, Y_STP, Ystps); //Y, Counterclockwise
delay(10);
step(false, X_DIR, X_STP, Xstps); //X, Clockwise
delay(10);
step(true, Y_DIR, Y_STP, Ystps); //Y, Counterclockwise
delay(10);
step(false, X_DIR, X_STP, Xstps); //X, Clockwise
delay(10);
step(true, Y_DIR, Y_STP, Ystps); //Y, Counterclockwise
delay(10);
step(false, X_DIR, X_STP, Xstps); //X, Clockwise
delay(10);
step(true, Y_DIR, Y_STP, Ystps); //Y, Counterclockwise
delay(10);
step(false, X_DIR, X_STP, Xstps); //X, Clockwise
delay(10);
step(true, Y_DIR, Y_STP, Ystps); //Y, Counterclockwise
delay(10);
step(false, X_DIR, X_STP, Xstps); //X, Clockwise
delay(10);
step(true, Y_DIR, Y_STP, Ystps); //Y, Counterclockwise
delay(10);
step(false, X_DIR, X_STP, Xstps); //X, Clockwise
delay(10);
step(true, Y_DIR, Y_STP, Ystps); //Y, Counterclockwise
delay(10);
step(false, X_DIR, X_STP, Xstps); //X, Clockwise
delay(10);
step(true, Y_DIR, Y_STP, Ystps); //Y, Counterclockwise
delay(10);
step(false, X_DIR, X_STP, Xstps); //X, Clockwise
delay(10);
step(true, Y_DIR, Y_STP, Ystps); //Y, Counterclockwise
delay(10);
step(false, X_DIR, X_STP, Xstps); //X, Clockwise
delay(10);
step(true, Y_DIR, Y_STP, Ystps); //Y, Counterclockwise
delay(10);
step(false, X_DIR, X_STP, Xstps); //X, Clockwise
delay(10);
step(true, Y_DIR, Y_STP, Ystps); //Y, Counterclockwise
delay(10);
step(false, X_DIR, X_STP, Xstps); //X, Clockwise
delay(10);
step(true, Y_DIR, Y_STP, Ystps); //Y, Counterclockwise
delay(10);
step(false, X_DIR, X_STP, Xstps); //X, Clockwise
delay(10);
step(true, Y_DIR, Y_STP, Ystps); //Y, Counterclockwise
delay(10);
step(false, X_DIR, X_STP, Xstps); //X, Clockwise
delay(10);

//Layer 2/12
step(false, X_DIR, X_STP, Xstps); //X, Clockwise
delay(10);
step(false, Y_DIR, Y_STP, Ystps); //Y, Clockwise
delay(10);
step(false, X_DIR, X_STP, Xstps); //X, Clockwise
delay(10);
step(false, Y_DIR, Y_STP, Ystps); //Y, Clockwise
delay(10);
step(false, X_DIR, X_STP, Xstps); //X, Clockwise
delay(10);
step(false, Y_DIR, Y_STP, Ystps); //Y, Clockwise
delay(10);
step(false, X_DIR, X_STP, Xstps); //X, Clockwise
delay(10);
step(false, Y_DIR, Y_STP, Ystps); //Y, Clockwise
delay(10);
step(false, X_DIR, X_STP, Xstps); //X, Clockwise
delay(10);
step(false, Y_DIR, Y_STP, Ystps); //Y, Clockwise
delay(10);
step(false, X_DIR, X_STP, Xstps); //X, Clockwise
delay(10);
step(false, Y_DIR, Y_STP, Ystps); //Y, Clockwise
delay(10);
step(false, X_DIR, X_STP, Xstps); //X, Clockwise
delay(10);
step(false, Y_DIR, Y_STP, Ystps); //Y, Clockwise
delay(10);
step(false, X_DIR, X_STP, Xstps); //X, Clockwise
delay(10);
step(false, Y_DIR, Y_STP, Ystps); //Y, Clockwise
delay(10);
step(false, X_DIR, X_STP, Xstps); //X, Clockwise
delay(10);
step(false, Y_DIR, Y_STP, Ystps); //Y, Clockwise
delay(10);
step(false, X_DIR, X_STP, Xstps); //X, Clockwise
delay(10);
step(false, Y_DIR, Y_STP, Ystps); //Y, Clockwise
delay(10);
step(false, X_DIR, X_STP, Xstps); //X, Clockwise
delay(10);
step(false, Y_DIR, Y_STP, Ystps); //Y, Clockwise
delay(10);
step(false, X_DIR, X_STP, Xstps); //X, Clockwise
delay(10);
step(false, Y_DIR, Y_STP, Ystps); //Y, Clockwise
delay(10);
step(false, X_DIR, X_STP, Xstps); //X, Clockwise
delay(10);
step(false, Y_DIR, Y_STP, Ystps); //Y, Clockwise
delay(10);
step(false, X_DIR, X_STP, Xstps); //X, Clockwise
delay(10);
step(false, Y_DIR, Y_STP, Ystps); //Y, Clockwise
delay(10);
step(false, X_DIR, X_STP, Xstps); //X, Clockwise
delay(10);
step(false, Y_DIR, Y_STP, Ystps); //Y, Clockwise
delay(10);
step(false, X_DIR, X_STP, Xstps); //X, Clockwise
delay(10);
step(false, Y_DIR, Y_STP, Ystps); //Y, Clockwise
delay(10);
step(false, X_DIR, X_STP, Xstps); //X, Clockwise
delay(10);
step(false, Y_DIR, Y_STP, Ystps); //Y, Clockwise
delay(10);
step(false, X_DIR, X_STP, Xstps); //X, Clockwise
delay(10);
step(false, Y_DIR, Y_STP, Ystps); //Y, Clockwise
delay(10);
step(false, X_DIR, X_STP, Xstps); //X, Clockwise
delay(10);
step(false, Y_DIR, Y_STP, Ystps); //Y, Clockwise
delay(10);
step(false, X_DIR, X_STP, Xstps); //X, Clockwise
delay(10);
step(false, Y_DIR, Y_STP, Ystps); //Y, Clockwise
delay(10);
step(false, X_DIR, X_STP, Xstps); //X, Clockwise
delay(10);
}

But it does one instruction at time

[/code]

DKWatson:
So, count the steps of the first motor (call it motor A) and call it stepsA. Whenever (stepsA + 88) % 1600 == 0, fire up motor B for 88 step with dir == CW. When (stepsA + 88) / 1600 == 20, change direction of motor B to CCW. Continue until (stepsA + 88) / 1600 == 41, allow motor B to run its final 88 steps CCW, change direction to CW, reset stepsA to zero, increment the loop counter and do it all over again until the loop counter indicates that you've completed six.

This sound about right?

Yes, this sounds greate! (: Can you please make me an example of how to add it in my code please? Cause i really don't know how to do it.

DKWatson:
So, count the steps of the first motor (call it motor A) and call it stepsA. Whenever (stepsA + 88) % 1600 == 0, fire up motor B for 88 step with dir == CW. When (stepsA + 88) / 1600 == 20, change direction of motor B to CCW. Continue until (stepsA + 88) / 1600 == 41, allow motor B to run its final 88 steps CCW, change direction to CW, reset stepsA to zero, increment the loop counter and do it all over again until the loop counter indicates that you've completed six.

This sound about right?

Actually i also need to make 2 full rotations (3200 steps) of motor A before the motor B moves and changes direction, is it possible to add this exception?

I just gave you all the logic! Now you want the code too?

Come on. Meet me half way at least. Just convert everything I said into counters, while loops and if statements. I wrote it in such a way as there is almost a direct correlation.

Hint: Make two functions, pulseA() and pulseB(). Each will send a single pulse to the respective motor. So, as you zip around loop sending and counting pulses to A, an if statement it testing the current count to see when it hits the trigger value. At this time a flag is enabled which allows a pulse to be sent to B while still zipping around loop. When the pulseB counter hits 88, the flag is clears which blocks entry into that code segment until the next time a trigger value gets hit.

Now, I can't give you any more clues that that without writing the code for you. Which I'm not going to do. So take a crack at, pull out some hair, and post what you came up with. If you're not prepared to put in the effort, why should I?

DKWatson:
I just gave you all the logic! Now you want the code too?

Come on. Meet me half way at least. Just convert everything I said into counters, while loops and if statements. I wrote it in such a way as there is almost a direct correlation.

Hint: Make two functions, pulseA() and pulseB(). Each will send a single pulse to the respective motor. So, as you zip around loop sending and counting pulses to A, an if statement it testing the current count to see when it hits the trigger value. At this time a flag is enabled which allows a pulse to be sent to B while still zipping around loop. When the pulseB counter hits 88, the flag is clears which blocks entry into that code segment until the next time a trigger value gets hit.

Now, I can't give you any more clues that that without writing the code for you. Which I'm not going to do. So take a crack at, pull out some hair, and post what you came up with. If you're not prepared to put in the effort, why should I?

You have just compleately right, and i apologize for asking. I will certainly try to make a code from your instructions.

Thank you for your helpful reply

Good luck and hurry back.

I tryed to make it a code, but there is an error: "expected primary-expression before '%' token" in this line:

if (stepsX + 88) % 1600 == 0

and i also don't know how to use the pulse function that DKwatson suggested me..

#define EN        8  

//Direction pin
#define X_DIR     5 
#define Y_DIR     6

//Step pin
#define X_STP     2
#define Y_STP     3 


int stepsX;

int stepsY=88;          //Y movement
int delayTime=200; //Delay between each pause (uS)

int voidloop_count;

void setup(){

  pinMode(X_DIR, OUTPUT); pinMode(X_STP, OUTPUT);

  pinMode(Y_DIR, OUTPUT); pinMode(Y_STP, OUTPUT);

  pinMode(EN, OUTPUT);

  digitalWrite(EN, LOW);

  voidloop_count++;
if(voidloop_count == 6)delay(6000000);

}

void loop(){

Serial.begin(9600);

Serial.print(stepsX);

if (stepsX + 88) % 1600 == 0
step(false, Y_DIR, Y_STP, stepsY); //Y, Clockwise

else (stepsX + 88) / 1600 == 20
step(true, Y_DIR, Y_STP, stepsY); //Y, Counterclockwise

stepsX=0;
  
}

Sere:
I tryed to make it a code, but there is an error: "expected primary-expression before '%' token" in this line:

if (stepsX + 88) % 1600 == 0

Your brackets are wrong. It should be

if ((stepsX + 88) % 1600) == 0

...R

Robin2:
Your brackets are wrong. It should be

if ((stepsX + 88) % 1600) == 0

...R

Thank you! I corrected it, but now it says me the same but "before '==' token"..

Could you tell me, if you know, if the code is right or not?

if (((stepsX + 88) % 1600) == 0)

DKWatson:
if (((stepsX + 88) % 1600) == 0)

DOH ... thank you.

...R

DKWatson:
if (((stepsX + 88) % 1600) == 0)

Thank you!! I fixed this and other errors in the code and i just tryed to run it. The result is that the B motor just pulse (probably) 88 steps CW and then 88 CCW, the other does not move…

So there is for sure something i had wrong in the program.

I tryed again to make some changes and this is the code:

#define EN        8  

//Direction pin
#define X_DIR     5
#define Y_DIR     6

//Step pin
#define X_STP     2
#define Y_STP     3

int delayTime=200; //Delay between each pause (uS)
int stepsX=3200;
int stepsY=88;          //Y movement

int voidloop_count = 0;
int XstepCount = 0;         // number of steps the motor has taken

void step(boolean dir, byte dirPin, byte stepperPin, int steps)

{

 digitalWrite(dirPin, dir);

 delay(50);

 for (int i = 0; i < steps; i++) {

   digitalWrite(stepperPin, HIGH);

   delayMicroseconds(delayTime); 

   digitalWrite(stepperPin, LOW);

   delayMicroseconds(delayTime); 

 }

}

void setup(){

 pinMode(X_DIR, OUTPUT); pinMode(X_STP, OUTPUT);

 pinMode(Y_DIR, OUTPUT); pinMode(Y_STP, OUTPUT);

 pinMode(EN, OUTPUT);

 digitalWrite(EN, LOW);


Serial.begin(9600);
}

void loop(){

 
 voidloop_count++;
if(voidloop_count == 6)delay(6000000);

Serial.print(stepsX);

step(false, X_DIR, X_STP, stepsX); //X, Clockwise 3200 steps

Serial.print("stepsX:");
 Serial.println(XstepCount);
 XstepCount++;

if (((stepsX + 88) % 1600) == 0);
step(false, Y_DIR, Y_STP, stepsY); //Y, Clockwise 88 steps

if (((stepsX + 88) / 1600) == 20);
step(true, Y_DIR, Y_STP, stepsY); //Y, Counterclockwise 88 steps

stepsX=0;
 
}

Could you please suggest me where am i wrong?

This line will do nothing

	if (((stepsX + 88) % 1600) == 0);

because it finishes with a semi-colon.

The code that is controlled by an IF must be enclosed within {}. Something like

	if (((stepsX + 88) % 1600) == 0) {
            // stuff to do
        }

Strictly speaking a single instruction can be combined on the same line as an IF but IMHO it makes a program much easier to follow if ALL the IF tests use {}

...R

Robin2:
This line will do nothing

 if (((stepsX + 88) % 1600) == 0);

because it finishes with a semi-colon.

The code that is controlled by an IF must be enclosed within {}. Something like

 if (((stepsX + 88) % 1600) == 0) {

// stuff to do
       }




Strictly speaking a single instruction can be combined on the same line as an IF but IMHO it makes a program much easier to follow if ALL the IF tests use {}

...R

Got it, thank you for your help. But the step() function remains a blocking function, so i can’t use it to run them at the same time as i am. How can i change that part of the code to make them move in sync?
I found this code searching in the forum posts for sync movement:

This allows steppers to move in sync for the same n of steps, as mine (88 steps) but in my case the starting point of the two steppers isn’t the same n of steps, so how can i modify it to make it work for me?

for(int s=0; s<step_360; s++)
{
myStepper1.step(1);
myStepper2.step(1);
}

Sere:
This allows steppers to move in sync for the same n of steps, as mine (88 steps) but in my case the starting point of the two steppers isn’t the same n of steps, so how can i modify it to make it work for me?

for(int s=0; s<step_360; s++)

{
myStepper1.step(1);
myStepper2.step(1);
}

I find that a bit confusing. is that a modification you have made to your own program or a piece of code you found somewhere else. If it is a modification to your program then please post the complete program.

If is not a modification to your own program then I don’t understand what you mean by “but in my case the starting point of the two steppers isn’t the same n of steps”

The general approach of doing in step for each motor is appropriate. If the two motors need to move different numbers of steps then don’t use a FOR loop. Just create two variable to count the steps and allow loop() to do the repetition.

…R

Robin2:
I find that a bit confusing. is that a modification you have made to your own program or a piece of code you found somewhere else. If it is a modification to your program then please post the complete program.

If is not a modification to your own program then I don’t understand what you mean by “but in my case the starting point of the two steppers isn’t the same n of steps”

The general approach of doing in step for each motor is appropriate. If the two motors need to move different numbers of steps then don’t use a FOR loop. Just create two variable to count the steps and allow loop() to do the repetition.

…R

It’s not a modification to my program, it is a way i found on this forum to make steppers move in sync.
I mean that for what i need the two steppers should not start at the same point and stop at the same point as the code i posted, that probably allow to move both steppers in sync for 360 degrees.

Anyway this no matter if the approach of my code it’s ok, but it does not work. I corrected the code i posted the last time in the #reply 14 and the result was only the movement of the X motor for a full rotation.

Then i tryed to change the loop again with this code:

for (int i=0; i <= 6; i++){

if (((stepsX + 88) / 1600) == 0) {
step(false, Y_DIR, Y_STP, stepsY); //Y, Clockwise 88 steps
}

if (((stepsX + 88) / 3200) == 0) {
step(false, Y_DIR, Y_STP, stepsY); //Y, Clockwise 88 steps
}

if (((stepsX + 88) / 4800) == 0) {
step(false, Y_DIR, Y_STP, stepsY); //Y, Clockwise 88 steps
}

if (((stepsX + 88) / 6400) == 0) {
step(false, Y_DIR, Y_STP, stepsY); //Y, Clockwise 88 steps
}

if (((stepsX + 88) / 8000) == 0) {
step(false, Y_DIR, Y_STP, stepsY); //Y, Clockwise 88 steps
}

if (((stepsX + 88) / 9600) == 0) {
step(false, Y_DIR, Y_STP, stepsY); //Y, Clockwise 88 steps
}

if (((stepsX + 88) / 11200) == 0) {
step(false, Y_DIR, Y_STP, stepsY); //Y, Clockwise 88 steps
}

if (((stepsX + 88) / 12800) == 0) {
step(false, Y_DIR, Y_STP, stepsY); //Y, Clockwise 88 steps
}

if (((stepsX + 88) / 14400) == 0) {
step(false, Y_DIR, Y_STP, stepsY); //Y, Clockwise 88 steps
}

if (((stepsX + 88) / 16000) == 0) {
step(false, Y_DIR, Y_STP, stepsY); //Y, Clockwise 88 steps
}

if (((stepsX + 88) / 17600) == 0) {
step(false, Y_DIR, Y_STP, stepsY); //Y, Clockwise 88 steps
}

if (((stepsX + 88) / 19200) == 0) {
step(false, Y_DIR, Y_STP, stepsY); //Y, Clockwise 88 steps
}

if (((stepsX + 88) / 20800) == 0) {
step(false, Y_DIR, Y_STP, stepsY); //Y, Clockwise 88 steps
}

if (((stepsX + 88) / 22400) == 0) {
step(false, Y_DIR, Y_STP, stepsY); //Y, Clockwise 88 steps
}

if (((stepsX + 88) / 24000) == 0) {
step(false, Y_DIR, Y_STP, stepsY); //Y, Clockwise 88 steps
}

if (((stepsX + 88) / 25600) == 0) {
step(false, Y_DIR, Y_STP, stepsY); //Y, Clockwise 88 steps
}

if (((stepsX + 88) / 27200) == 0) {
step(false, Y_DIR, Y_STP, stepsY); //Y, Clockwise 88 steps
}

if (((stepsX + 88) / 28800) == 0) {
step(false, Y_DIR, Y_STP, stepsY); //Y, Clockwise 88 steps
}

if (((stepsX + 88) / 30400) == 0) {
step(false, Y_DIR, Y_STP, stepsY); //Y, Clockwise 88 steps
}

if (((stepsX + 88) / 32000) == 0) {
step(false, Y_DIR, Y_STP, stepsY); //Y, Clockwise 88 steps
}

if (((stepsX + 88) / 35200) == 0) {
step(false, Y_DIR, Y_STP, stepsY); //Y, Clockwise 88 steps
}

if (((stepsX + 88) / 36800) == 0) {
step(false, Y_DIR, Y_STP, stepsY); //Y, Clockwise 88 steps
}

if (((stepsX + 88) / 38400) == 0) {
step(false, Y_DIR, Y_STP, stepsY); //Y, Clockwise 88 steps
}

if (((stepsX + 88) / 40000) == 0) {
step(false, Y_DIR, Y_STP, stepsY); //Y, Clockwise 88 steps
}

if (((stepsX + 88) / 41600) == 0) {
step(false, Y_DIR, Y_STP, stepsY); //Y, Clockwise 88 steps
}

if (((stepsX + 88) / 43200) == 0) {
step(false, Y_DIR, Y_STP, stepsY); //Y, Clockwise 88 steps
}

if (((stepsX + 88) / 44800) == 0) {
step(false, Y_DIR, Y_STP, stepsY); //Y, Clockwise 88 steps
}

if (((stepsX + 88) / 46400) == 0) {
step(false, Y_DIR, Y_STP, stepsY); //Y, Clockwise 88 steps
}

if (((stepsX + 88) / 48000) == 0) {
step(false, Y_DIR, Y_STP, stepsY); //Y, Clockwise 88 steps
}

if (((stepsX + 88) / 49600) == 0) {
step(false, Y_DIR, Y_STP, stepsY); //Y, Clockwise 88 steps
}

if (((stepsX + 88) / 51200) == 0) {
step(false, Y_DIR, Y_STP, stepsY); //Y, Clockwise 88 steps
}

if (((stepsX + 88) / 52800) == 0) {
step(false, Y_DIR, Y_STP, stepsY); //Y, Clockwise 88 steps
}

if (((stepsX + 88) / 54400) == 0) {
step(false, Y_DIR, Y_STP, stepsY); //Y, Clockwise 88 steps
}

if (((stepsX + 88) / 56000) == 0) {
step(false, Y_DIR, Y_STP, stepsY); //Y, Clockwise 88 steps
}

if (((stepsX + 88) / 57600) == 0) {
step(false, Y_DIR, Y_STP, stepsY); //Y, Clockwise 88 steps
}

if (((stepsX + 88) / 59200) == 0) {
step(false, Y_DIR, Y_STP, stepsY); //Y, Clockwise 88 steps
}

if (((stepsX + 88) / 60800) == 0) {
step(false, Y_DIR, Y_STP, stepsY); //Y, Clockwise 88 steps
}

if (((stepsX + 88) / 62400) == 0) {
step(false, Y_DIR, Y_STP, stepsY); //Y, Clockwise 88 steps
}

if (((stepsX + 88) / 64000) == 0) {
step(false, Y_DIR, Y_STP, stepsY); //Y, Clockwise 88 steps
}

if (((stepsX + 88) / 65600) == 0) {
step(false, Y_DIR, Y_STP, stepsY); //Y, Clockwise 88 steps
}

stepsX=0;
}

But here the result was a full rotation of the X motor and then 88 intermitting steps of the Y motor (without the x movements).

I don’t really know where i am wrong…

Please always post a complete program.

The way I would move two stepper is something like this

void loop() {
  if (stepper1pos < stepper1destination) {
       myStepper1.step(1);
       stepper1pos ++;
   }
  if (stepper2pos < stepper2destination) {
       myStepper2.step(1);
       stepper2pos ++;
   }
   delay(intervalBetweenSteps);
}

Obviously you also need code to set the initial value for stepper1pos and the value for stepper1destination. For testing you could set those in setup()

And for a working program you will probably not want to use delay() and you may wish to have separate step intervals for each motor.

…R