Stepper motor not working properly!

Hello everyone!

I have tried for weeks to get my stepper motor to work properly. I have a 28byj-48 5V DC as my stepper motor and a ULN2003 as my Driver which is quite commonly used.

I have watched many tutorials and how to’s using these specific motor and driver and tried their code ( Over 20 different codes that works for them with the same motor and driver) , ive also tried coding it myself but nothing seems to work.

Ive only got one code work somewhat but as soon i change anything it does not work.
If i change the stepper.setspeed from something other than 60 it does not work even if i change the rev accordingly.

The code that atleast did something is linked below.
It basically just keeps on spinning even if i add a delay in the loop it stops working.

What could be the problem? a faulty driver or a faulty motor maybe?

#include <Stepper.h>


const int Steps = 512;
boolean dir = false;// false =clockwise, true=counter clockwise


Stepper stepper(Steps, D1, D3, D2, D4);


void setup()
{
  stepper.setSpeed(60);
  Serial.begin(9600);
}




void loop()
{

 stepper.step(Steps);

}

Which Arduino?

It does seem strange that even small changes stop it working. Try to reduce the speed by half, to 30?

Have you tried the AccelStepper library?

Insufficient power, possibly.

Do you have the standard 28byj-48 stepper (2048 full steps per shaft revolution, max RPM about 13) or this one from Adafruit:

(about 513 steps per rev, 35 RPM)?
EDIT: Don't use pin D1 it's the serial TX pin, try 3,2,4,5 and stepper.setSpeed(10) to start.