ignacij:
While is because it has to be.while (1)
{
stepper1.setSpeed(SetMotorSpeed1); // hitrost posameznega kolesa
stepper2.setSpeed(SetMotorSpeed2);
stepper3.setSpeed(SetMotorSpeed3);
stepper4.setSpeed(SetMotorSpeed4);
stepper1.run();
stepper2.run();
stepper3.run();
stepper4.run();
if (Genotronex.available()!=0)
{
while (Genotronex.available() > 0) // .parseFloat() can leave non-numeric characters
{
junk = Genotronex.read() ; // clear the keyboard buffer
}
break;
}
}
If there is not while, then motors won't spin. All they do without while loop, is one step.
Any while in your sketch is most likely wrong. loop() is called in a loop, that's all the looping
you need for a well behaved sketch where the different parts cooperate.
Place calls to stepper1.run(), stepper2.run() etc in the body of loop(), make sure loop runs
frequently by always returning promptly from it.