stepper.h

Im doin a project in college and it is my first time using Arduino code so im a bit confused. does anyone know what this stepper.h means. I have code to turn a stepper motor clockwise one revolution and counter closkwise one revolution but I cant describe what the stepsPerRevolution command means or what it is doing. I thought I had to have the direction pin on my driver board which is a 5804 unipolar driver high to turn the motor one way and low to turn it the other way, but as there is only 4 input connections to the driver board ( h-step, dir, s-inp and one phase) and in the code there is 4 pins from the arduino being used i dont understand how this code is driving the motor correctly. below is the code
#include <Stepper.h>

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

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

void setup() {
// set the speed at 60 rpm:
myStepper.setSpeed(60);
// initialize the serial port:
Serial.begin(9600);
}

void loop() {
// step one revolution in one direction:
Serial.println("clockwise");
myStepper.step(stepsPerRevolution);
delay(500);

// step one revolution in the other direction:
Serial.println("counterclockwise");
myStepper.step(-stepsPerRevolution);
delay(500);
}

The line #include <Stepper.h> adds into your code the Arduino stepper library. The details of how to use it should be in the online Reference section under Libraries.

...R

I believe that your controller is not supported by the stepper library.
get something like the L298N (stepper lib can be used)

knut_ny:
I believe that your controller is not supported by the stepper library.
get something like the L298N (stepper lib can be used)
Arduino Connecting Easy Driver Stepper Motor Controller

Let's be careful, here ...

The easy-driver uses an Allegro A3967 stepper driver chip which is a good product. If used with an appropriate (low current) stepper motor it can just be connected directly to the motor. There is no need for an L298. If you need more current capability there are the big-easy-driver or the Pololu A4988 stepper driver boards.

If you put an L298 into the circuit you will lose the stepper driver board's ability to limit the current in the motor coils and, consequently, the ability to use higher voltages to improve motor torque at higher speeds.

The accelStepper library seems to be much more comprehensive than the stepper library.

...R