the stepper motor is not rotating just vibrating

I am using a 28BYJ-48 Stepper motor

#include <Stepper.h>
const int stepsPerRevolution=4096;
Stepper leftStepper(8,9,10,11);
void setup() {
// put your setup code here, to run once:
pinMode(8, OUTPUT);

void loop() {
// put your main code here, to run repeatedly:

Try with a much lower speed, after consulting the documentation for the motor driver library.

If that doesn't help, the motor wires may be swapped. With the power off, swap a pair of wires, power up and try again. If that doesn't fix the problem, repeat with another pair of wires.

PS: please read the "How to use this forum" post for instructions on how to post code properly and which important details to provide.

Check your wiring. If you've been following the usual tutorials for the 28BYJ then the connection you have as Stepper leftStepper(8,9,10,11); should be Stepper leftStepper(8,10,9,11);

This seems strange

const int stepsPerRevolution=4096;

to the best of my knowledge (see this web page) the 28BYJ motors have 32 full steps per revolution of the motor


@Robin2 from the web page you posted:

These means that in the recommended half-step mode we will have:64 steps per motor rotation x 63.684 gear ratio = 4076 steps per full revolution (approximately).

@Robin2 from the web page you posted:

Very true. However the Arduino is controlling the motor, not the output shaft.