I'm trying to write the code with the AccelStepper Library, I need to move some stepper motor drived by an uln2003 chip, for now I've done the moviment for each one separated, and it works...but I need to build some cycles to separate the operation, in one cycle move them toghether, and in another set for each one the position, all working at the same time, but when I create a cycle and move the code in all the motors works each one per time, when out of the cycle they work all toghether...can someone help me? Thanks in advance for the aviability, regards. Riccardo
if (stepper1.distanceToGo() == 0)
stepper1.moveTo(-stepper1.currentPosition());
delay(0);
if (stepper2.distanceToGo() == 0)
stepper2.moveTo(-stepper2.currentPosition());
delay(0);
if (stepper3.distanceToGo() == 0)
stepper3.moveTo(-stepper3.currentPosition());
delay(0);
if (stepper4.distanceToGo() == 0)
stepper4.moveTo(-stepper4.currentPosition());
stepper1.run();
stepper2.run();
stepper3.run();
stepper4.run();
}
I'm trying to move the code of the void loop in two separate loop, that will be executed a number n of times and then switchto the next cycle, It's right what I'm trying to do? Thanks.
Will people please STOP REFERRING TO THE LOOP() FUNCTION AS 'the void loop'.
It is not a void, it is a function. Function names are preceded by the type of data that the function returns. If the function does not return any data then it is referred to as void.