Thanks for reading my question. I would like to know the time it takes to take a full turn. I have 1 nema 17 engine (stepper motor) but, I want to know how long it takes to complete 1 turn because from that I will make a relationship to be able to put on a keypad and reflect it on an LCD for how long you want it to be turning the motor steps. Try to do a sampling time and using volatile unsigned but it is not very close, so I ask for help. Below leave only the code, where the movement is made, I suppose it will be in the cycle for which the condition will be set. Thank you! sorry if I do not explain myself well, I do not speak English very well.THE COMPLETE CODE IS DOWN, THE DOWNLOADABLE FILE

for (int i = 0; i <a; i ++) {schedule2 ();

for (int i = 0; i <totalpasos2; i ++) {m2 ();} // Equivalent to the number of turns (200 steps are 360º degrees of servo)

// --------- Change of direction of rotation ---------------------------------- -------------------------------------------------- —

anti-clock2 (); // send direction to the servo

for (int i = 0; i <totalpasos2; i ++) {m22 ();}} // Equivalent to the number of turns (200 steps are 360 degrees of servo)

digitalWrite (reset1, LOW);

break;

case ‘F’:

for (int i = 0; i <a; i ++) {// Equivalent to the number of turns (200 steps are 360 degrees of servo)

schedule1 ();

schedule2 ();

for (int i = 0; i <totalpasos1; i ++) {// Equivalent to the number of turns (200 steps are 360º degrees of servo)

m1 ();

m2 ();}

// --------- Change of direction of rotation ---------------------------------- -------------------------------------------------- -

anti-clock1 ();

anti-clock2 ();

for (int i = 0; i <totalpasos1; i ++) {// Equivalent to the number of turns (200 steps are 360º degrees of servo)

m11 ();

m22 ();}}

digitalWrite (reset1, LOW);

codigo en ingles.txt (7.92 KB)