Obtain variable (degrees) of the movements of two stepper motors

Hi,

I ve this code with a movements for a scanner 3d with a LIDAR. My problem is that i need to know the degrees of the movements in every moment, for mix it with the LIDAR measures. How can i get these variables?

#include <Stepper.h>
const int stepsPerRevolution = 200; // change this to fit the number of steps per revolution for the motor
int contador=0;
float alpha=0;
float alpha2=0;
const float pi = 3.141593;
int f=0;

Stepper myStepperZ(stepsPerRevolution, 8, 9, 10, 11); // initialize the stepper library on pins 8 through 11:
Stepper myStepperY(stepsPerRevolution, 3, 4, 5, 6);

void setup() {
myStepperZ.setSpeed(20); // set the speed at 20 rpm:
myStepperY.setSpeed(5); // set the speed at 5 rpm:
Serial.begin(9600); // initialize the serial port:
}

void loop() {
delay(6000); //delay de un minuto antes de empezar
while(contador<25){ //25repeticiones
myStepperZ.step(200);// step one revolution in one direction (sentido horario):
delay(500);
myStepperY.step(1);
delay(500);
myStepperZ.step(-200);// step one revolution in the other direction (sentido antihorario):
delay(500);
myStepperY.step(1);
delay(500);
contador++;
}
}

This code has several stepper movements and lots of delay()s and a WHILE

void loop() {
    delay(6000);  //delay de un minuto antes de empezar
    while(contador<25){  //25repeticiones
        myStepperZ.step(200);// step one revolution  in one direction (sentido horario):
        delay(500);
        myStepperY.step(1);
        delay(500);
        myStepperZ.step(-200);// step one revolution in the other direction (sentido antihorario):
        delay(500);
        myStepperY.step(1);
        delay(500);
        contador++;
    }
}

At what points in the program do you wish to identify the angle of the stepper motor?

Code such as

myStepperZ.step(200);

will block the Arduino until all 200 steps are complete. If you need to know the angles during that move you need EITHER to move in single steps OR use the non-blocking ability of the AccelStepper library

What stepper motor driver are you using?

…R
Stepper Motor Basics
Simple Stepper Code