#include <AccelStepper.h>
// Define some steppers and the pins the will use
AccelStepper stepper1(AccelStepper::FULL2WIRE, 2, 5);
AccelStepper stepper2(AccelStepper::FULL2WIRE, 3, 6);
void setup()
{
//EG STEP SIZE 800: SPEED800==30 RPM SPEED1600== 60 RPM SPEED3200== 120RPM
//120 RPM
stepper1.setMaxSpeed(3200);
stepper1.setAcceleration(6400);
stepper1.moveTo(100000000);
//20 RPM 533
stepper2.setMaxSpeed(533);
stepper2.setAcceleration(6400);
stepper2.moveTo(100000000);
Serial.begin(9600);
Serial.println("Enter '1' to Start. Enter '0' to Stop ");
}
void loop()
{
if (Serial.available())
{
char ch = Serial.read();
if (ch == '1')
{
Serial.println("Starting");
if (stepper1.distanceToGo() == 0)
stepper1.moveTo(-stepper1.currentPosition());
stepper1.run();
stepper2.run();
}
else if (ch == '0')
{
Serial.println("Stopping");
stepper1.stop();
stepper2.stop();
}
}
}
Essentially I'm new. I'm trying to give commands to start and stop the motors. I set the moveTo really high so they run for however long I need them to. Everytime I entire '1' nothing happens. However if I send it 2-3 times, the motors seemingly die. As in their Amp draw cuts in half and nothing happens. I cannot even test entering '0' because the motors aren't even moving.
Specs: Arduino Uno
2 MySweety TB6600 drivers
2 Stepper motors
1 30V 10A max power supply
The motors are powered in parallel but they're 4 wire bipolar stepper motors.