Hi there, I need help correction of the coding below. anyone willing to help, will need to include the timer for motor x and LDR for motor y, wanted to first get the two motors running before setting the sensors please
void setup() {
#include <AccelStepper.h>
// The X Stepper pins
#define Stepper1_DIR_PIN 3; //motor direction
#define Stepper1_PULS_PIN 5; //motor puls
#define Stepper1_EN_PIN 7; //enabling motor
#define Stepper1_GND_PIN +5V
// The Y Stepper pins
#define Stepper2_DIR_PIN 11
#define Stepper2_PULS_PIN 9
#define Stepper2_EN_PIN 13
#define Stepper2_GND_PIN +5V
//Define some steppers and the pins the will use
AccelStepper Stepper1(AccelStepper::DRIVER, STEPPER1_DIR_PIN 3, STEPPER1_PULS_PIN 5, STEPPER1_EN_PIN 7, STEPPER1_GND_PIN +5V);
AccelStepper Stepper2(AccelStepper::DRIVER, STEPPER2_DIR_PIN 11, STEPPER2_PULS_PIN 9, STEPPER2_EN_PIN 13, STEPPER2_GND_PIN +5V);
}
void setup()
{
stepper1.setMaxSpeed(20.0);
stepper1.setAcceleration(20.0);
stepper1.moveTo(10);
stepper2.setMaxSpeed(10.0);
stepper2.setAcceleration(10.0);
stepper2.moveTo(10);
}
void loop() {
// change direction at the limits
if (stepper1.distanceToGo()==0)
stepper1.moveTo(-stepper1.currentPosition());
if (stepper2.distanceToGo()==0)
stepper.moveTo(-stepper2.currentPosition());
stepper1.run();
stepper2.run();
}