CONTINUES TWO STEPPER MOTOR WITH ULN2003

STEPPER2 uln

The code can be downloaded at:

https://github.com/triantara/ARDUINO-TRIANTARA/blob/main/TWO%20STEPPER%20ULN.zip

#include <AccelStepper.h>
#define HALFSTEP 8

// Motor pin definitions
#define motorPin1 12 // IN1 on the ULN2003 driver 1
#define motorPin2 11 // IN2 on the ULN2003 driver 1
#define motorPin3 10 // IN3 on the ULN2003 driver 1
#define motorPin4 9 // IN4 on the ULN2003 driver 1

#define motorPin5 8 // IN1 on the ULN2003 driver 2
#define motorPin6 7 // IN2 on the ULN2003 driver 2
#define motorPin7 6 // IN3 on the ULN2003 driver 2
#define motorPin8 5 // 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(1000.0);
stepper1.setSpeed(1000);
stepper2.setMaxSpeed(1000.0);
stepper2.setAcceleration(1000.0);
stepper2.setSpeed(1000);

}//–(end setup )—

void loop() {
stepper1.moveTo(stepper1.currentPosition()+500);
stepper2.moveTo(stepper2.currentPosition()-500);
stepper1.run();
stepper2.run();
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s