Your code seems to be very confused.
In this function
void stepMotor(boolean dir, int nSteps, int dirPin, int stepPin) // Input - Value for Direction Pin, Number of
Steps to be moved pins, uC Pins for direction and step
{
digitalWrite(dirPin, dir); // HIGH - Towards the Motor || LOW - Away from the Motor
delayMicroseconds(2);
for (int i = 0; i < nSteps; i++)
{
digitalWrite(stepPin, HIGH);
delayMicroseconds(pulsePeriod);
digitalWrite(stepPin, LOW);
delayMicroseconds(pulsePeriod);
}
}
you have a pulse width of 800 microsecs (when 10 is probably sufficient) AND you have also an interval after the pulse of 800 µsecs.
Then in this code
for (int i = 0; i < nMoveSteps; i++)
{
stepMotor(HIGH, 1, dPin, sPin);
delay(delayTime); // For Delay between each step
}
you add an extra interval of 2 millisecs.
I suggest you change your function to
void stepMotor(boolean dir, int nSteps, int dirPin, int stepPin)
{
digitalWrite(dirPin, dir); // HIGH - Towards the Motor || LOW - Away from the Motor
delayMicroseconds(2);
for (int i = 0; i < nSteps; i++)
{
digitalWrite(stepPin, HIGH);
delayMicroseconds(10);
digitalWrite(stepPin, LOW);
delay(intervalBetweenSteps);
}
}
and then remove the speed control from loop().
And start with a value of 20 millisecs for the intervalBetweenSteps as that will give a modest 50 steps per second - or even try a longer interval.
...R