int DIR_PIN = 10; // the pin which the driver's DIR PIN is connected to on the arduino board
int STEP_PIN = 3; // the pin which the driver's STEP PIN is connected to on the arduino board
int const MOVE_SPEED = 2000; // The stepper will work better when there is more of a delay. Decreasing this will reduce its power.
int const TOTAL_STEPS = 48; // The number of steps that the stepper motor will take
int const MICROSTEPS = 8; // Each step is broken down into 8 microsteps by the driver.
void setup() {
Serial.begin( 9600 );
// Set up each of the pins for output
pinMode(DIR_PIN, XXXXXX);
pinMode(STEP_PIN, XXXXXX);
}
void step(boolean dir,int steps){
// Set the direction to forwards or backwards
// by changing the state of the direction PIN
if( dir == true )
digitalWrite(DIR_PIN, HIGH);
else
digitalWrite(DIR_PIN, LOW);
// wait a short amount of time
// before controlling the steps
delay(50);
// The driver sees each step as a set of 8 microsteps
// So multiply by 8 to make it smooth and appropriate
steps = steps * MICROSTEPS;
// Loop for each step needed
for(int i=0;i