Hello I am trying to use a stepper motor with a DM860A microstep driver.
Driver Setting is for 400pulses/rev. In order to test my wiring and setup I am using an Arduino UNO running Tom Igoe's sketch "one revolution each direction". (reproduced below).
The only changes I have made are to set the pulses per rev to 400 and to initialize "stepper" to pins 8 and 9. Connections are 8 DIR 9 PUL and 13 ENBL. DIP switch setting 1 OFF, 2-8 ON
I also included a print statement to be sure that I was generating the correct number of pulses. The code runs and rotates the motor in both directions but not a full rev, only about a quarter of a rev.
Can anybody please suggest what I am doing wrong?
Thanks
Alan
/*
Stepper Motor Control - one revolution
This program drives a unipolar or bipolar stepper motor.
The motor is attached to digital pins 8 - 11 of the Arduino.
The motor should revolve one revolution in one direction, then
one revolution in the other direction.
Created 11 Mar. 2007
Modified 30 Nov. 2009
by Tom Igoe
*/
#include <Stepper.h>
int const stepsPerRevolution = 400; // 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);
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");
Serial.print (stepsPerRevolution);
myStepper.step(stepsPerRevolution);
delay(2000);
// step one revolution in the other direction:
Serial.println("counterclockwise");
myStepper.step(-stepsPerRevolution);
delay(500);
}