Hi there,
Im trying to get two stepper motors to rotate at the same time. when i run the program (shown below) both steppers rotate but NOT AT THE SAME TIME:(. the first one rotates and then the second one rotates. is there a way to mod this program so BOTH STEPPERS RUN AT THE SAME TIME:). ANY HELP would be appreciated. thanks in advance. this is the code that im using (its basically from the samples, just modifies a bit):
CHEERS!!
#include <AccelStepper.h>
#include <MultiStepper.h>
AccelStepper stepper(1, 4, 9);
AccelStepper stepper2(1, 3, 8);
void setup()
{
stepper.setMaxSpeed(2000.0);
stepper.setAcceleration(500.0);
stepper2.setMaxSpeed(2000.0);
stepper2.setAcceleration(500.0);
Serial.begin(9600);
}
float val = 0 ;
float val2 = 0 ;
void loop(){
if (Serial.available() > 0 ) {
val = Serial.parseFloat( );
Serial.print("stepper 1 = ");
Serial.println(val);
stepper.runToNewPosition(val);
val2 = Serial.parseFloat( );
Serial.print("stepper 2 = ");
Serial.println(val2);
stepper2.runToNewPosition(val2);
}
}