I'm using a 28BYJ-48 stepper motor with a ULN2003 driver board. I'm trying to control the motor using an Arduino MEGA. I initially connected the pins on the driver: IN1,2,3,4 to pins of the Arduino: 8,9,10,11 respectively; as was given in a youtube video I referred to(https://www.youtube.com/watch?v=HdqCtAJxhrs). The power for the motor was given from the 5V and GND ports in the Arduino. What happens is that it rotates 180 degrees,and then stops and then goes at random angles and stops. This was the code:
#include <Stepper.h>
Stepper stepper1(64,8,9,10,11);
int a=1;
void setup() {
stepper1.setSpeed(50);
}
void loop() {
while(a<10){
stepper1.step(2048);
delay(1000);
a++;
}
}