This tells stepper 1 to go to 400 and stop and stepper 2 to go to -100 and stop. Loop runs again and the steppers are already at those positions so nothing happens. Loop() is running, there is just nothing to do.
in reply #2 you are moving the same motor back and forth so each loop the positions change.
RunToPosition blocks. There are non blocking methods (which you will need if you want to do much with 4 steppers). AccelStepper reference.
So is it possible to connect 1 resistance sensor and if is sensor is HIGH
start loop again.
You don't start and stop loop(). Loop() will run over and over as fast as it can. How fast that is depends on your code. If you want responsive code you can not use blocking functions (like delay() or runToNewPosition()).
if (digitalRead (limitSensore)==HIGH) {
return;
I don't know the context of that code.
i don't understand well this accelstepper
It is not easy to understand. That is why I provided all of those links. Study and run some of the examples and you should pick it up.
stepper motor go cw 500 --- stepper.runToNewPosition(500);
stepper motor go ccw -300 --- stepper.runToNewPosition(-300);
stepper motor go cw 200 --- stepper.runToNewPosition(200);
stepper motor go cww - 100 --- stepper.runToNewPosition(-100);
and then continue from start
I have many project runung (DC motors,Stepper motors) with push buttons,potentiometers,sensors,limitswitches
so i trying to build robot arm and i wish to control steppers as (lets say servo)
i know stepper cannot remember position,so i need many different movements.
Firs i wish to learn with 1 stepper to understan how it works accelstepper.
cw and ccw.
that is reason way i have 1 motor with:
stepper1
stepper2
stepper3
......
to move motor cw and ccw as i wish but when is don i need code to be repeated or reloaded...