Hi All Arduino members! ![]()
I need to change a short Arduino Accel Stepper code for stepper motors to PLC Ladder Logic.
But I can't ![]()
Please help me guys
here is the code:
#include <AccelStepper.h>
// Define some steppers and the pins the will use
// Defaults to AccelStepper::FULL4WIRE (4 pins) on 2, 3, 4, 5
AccelStepper stepper2(AccelStepper::FULL4WIRE, 14, 15);
AccelStepper stepper3(AccelStepper::FULL4WIRE, 10, 11);
void setup()
{
stepper2.setMaxSpeed(300.0);
stepper2.setAcceleration(100.0);
stepper2.moveTo(10000);
stepper3.setMaxSpeed(300.0);
stepper3.setAcceleration(100.0);
stepper3.moveTo(10000);
}
void loop()
{
// Change direction at the limits
if (stepper2.distanceToGo() == 0)
stepper2.moveTo(-stepper2.currentPosition());
stepper2.run();
stepper3.run();
}