Change A4988 board code to ULN2003 board code in a sketch

How would you convert the following listed open source sketch to work with a ULN2003 Stepper Driver
Board and 28BYJ-48 Motor on a Mega2560?, at url:

The code currently uses a custom driver board based on a, A4988: DMOS Microstepping Driver, with: step, direction, and enable. The ULN2003 stepper driver board is a basic a 4-pin driver board for motor coils and pins for motor pwr and gnd.

I have all ready re-assigned the pin outs in the sketch and tried selecting the enable option to "0" and
included the libraries and reset the motor steps per revolution, but no go. Irr, the the motors and my
bread board setup work with other sketches. My programing skills are in the, "learn as you go mode." I have not found info on this on this forum and have read the stepper motor basics.

Here is the other helpful necessary evil information and links:

  1. The sketch, is at:

  2. The stepper driver board Cerebralmeltdown is using: is based on A4988: DMOS Microstepping Driver at:

  3. The motor and driver board I want to use is at: 4tronix Arduino
    and at

  4. More ULN2003 driver board info at: ULN2003 Stepper Driver Board and 12V 28BYJ-48 Motor Test - Experimentos en Hardware Libre

I know that these motors can't get out of their own way power wise, but the intended purpose is proof
of concept pan and tilt system to track the sun.

Is this "easy peasey" or a big "pia"?

I tried to find your code. I failed. If you want help, make it easy. Post your code HERE.

The Code is in the attached zip file.

This is where, in the code, I need to figure out how to go from a two wire driver board to a four wire board. I tried assigning 4 pins to the azimuth and altitude, and #include <AccelStepper.h> like the other code the dives the motors in a different sketch.

int azimuthStepPin = 2;
int azimuthDirPin = 3;

int altitudeStepPin = 4;
int altitudeDirPin = 5;

int EnablePin = 6;

This is part of the code that drives the motors in a different sketch:

#include <AccelStepper.h>
/-----( Declare Constants and Pin Numbers )-----/
#define FULLSTEP 4
#define HALFSTEP 8
// motor pins
#define motorPin1 4 // Blue - 28BYJ48 pin 1
#define motorPin2 5 // Pink - 28BYJ48 pin 2
#define motorPin3 6 // Yellow - 28BYJ48 pin 3
#define motorPin4 7 // Orange - 28BYJ48 pin 4
// Red - 28BYJ48 pin 5 (VCC)

#define motorPin5 8 // Blue - 28BYJ48 pin 1
#define motorPin6 9 // Pink - 28BYJ48 pin 2
#define motorPin7 10 // Yellow - 28BYJ48 pin 3
#define motorPin8 11 // Orange - 28BYJ48 pin 4
// Red - 28BYJ48 pin 5 (VCC) (54.4 KB)

It is going to be a big job using a different driver board. The code does not use the Stepper or AccelStepper library. Instead, it implements its own move with acceleration function.

Ok, thanks, I'll expedite "Plan B."

If you define both steppers like in de examples:

#include <Stepper.h>

const int stepsPerRevolution = 200; // change this to fit the number of steps per revolution
// for your motor

// initialize the stepper library on pins 8 through 11:
Stepper azimuth(stepsPerRevolution, 8, 9, 10, 11);
Stepper altitude(stepsPerRevolution, 8, 9, 10, 11);

then you can use::

azimuth.step(1); //azimuth motor one step forward
azimuth.step(-1); //azimuth motor one step backward
altitude.step(1); //altitude motor one step forward
altitude.step(-1); //altitude motor one step backward

then replace all of the “digitalWrite(altitudeDirPin, HIGH)” with something like altitudeDir = 1, and replace all of the “digitalWrite(altitudeDirPin, LOW)” with something like altitudeDir = -1

next replacement might be when the program actually sends a step to the motors:
replace “digitalWrite(altitudeStepPin, HIGH);” for altitude.step(altitudeDir)

and you’ll have to delete some lines because de statment digitalWrite(altitudeStepPin, LOW);
won’t be necesary.

Basically you have to find where in code the programa does the actual turn of the motors, in that place you have to substitute with the new code por the stepper and eliminate the old lines controling the step/dir.