I want to make a robot, drived with 2 stepper 28BIY-48 motors and ULN2003 drivers. I copied a code from internet and change it so it can control 2 motors, but it gives an error about that the var "motorPin1" not is defined, but in a line some lines above it is definend. What am i doing wrong?
#include <AccelStepper.h>
#define HALFSTEP 10
// Motor pin definitions
//==motorRight==\\
#define motorPin1 10 // IN1 on the ULN2003 driver 1
#define motorPin2 11 // IN2 on the ULN2003 driver 1
#define motorPin3 12 // IN3 on the ULN2003 driver 1
#define motorPin4 13 // IN4 on the ULN2003 driver 1
//==motorLeft==\\
#define motorPin5 6 // IN1 on the ULN2003 driver 2
#define motorPin6 7 // IN2 on the ULN2003 driver 2
#define motorPin7 8 // IN3 on the ULN2003 driver 2
#define motorPin8 9 // IN4 on the ULN2003 driver 2
// Initialize with pin sequence IN1-IN3-IN2-IN4 for using the AccelStepper with 28BYJ-48
AccelStepper stepper1(HALFSTEP, motorPin1, motorPin3, motorPin2, motorPin4);
AccelStepper stepper2(HALFSTEP, motorPin5, motorPin7, motorPin6, motorPin8);
void setup()
{
stepper1.setMaxSpeed(1000.0);
stepper1.setAcceleration(100.0);
stepper1.setSpeed(200);
stepper1.moveTo(20000);
stepper2.setMaxSpeed(1000.0);
stepper2.setAcceleration(100.0);
stepper2.setSpeed(200);
stepper2.moveTo(20000);
}
void loop()
{
stepper1.run();
stepper2.run();
}