user19111: I'm having trouble using the ENABLE pin on my microstepper driver, I'm not sure of the exact model but it looks exactly like the one pictured here
Microstepper Driver
Here's my code:
#define MAX_LEN 8
#define MIN_INCREMENT 0.5
#define LIMIT_SWITCH 3
#define ENABLE 10
float buoyancymass = 4401.425;
float centrebuoyancy = 14.164;
float mainarm = 14.3;
float nosearm = 1.8;
float adc = 11.4;
float meanadc = 22.65; 
volatile byte enable_state = LOW;


#include <Stepper.h>

const int stepsPerRevolution = 1600;  // 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);

int stepCount = 0;         // number of steps the motor has taken
float stepinch = 0.00524; // 1 step = x"

void setup() {
  // initialize the serial port:
  Serial.begin(9600);
  pinMode(LIMIT_SWITCH, INPUT_PULLUP);
  pinMode(ENABLE, OUTPUT);
  //enable motor
  digitalWrite(ENABLE, enable_state);
  //interrupt
  attachInterrupt(digitalPinToInterrupt(LIMIT_SWITCH), limitbrake, FALLING);
  // set the speed
  myStepper.setSpeed(30);
}

void limitbrake() {
  digitalWrite(ENABLE, !enable_state);
}

The problem I'm noticing is that when I set the pinMode(ENABLE,OUTPUT); my stepper doesn't draw current and therefor, doesn't drive. This occurs regardless of whether I set my enable_state to HIGH or LOW.
Funny enough, when I set it to pinMode(ENABLE,INPUT); it does draw current and drive the motor, but unfortunately my limit switch which I've attached an interrupt to doesn't disable the motor when its pressed. 
Before you ask, I've tested the enable pin on my driver and my limit switch circuitry in other programs and they both work. I'm just having trouble with putting it together. 
Here is the rest of my code if you were wondering. 
float calc_margin(float pos, float mass) {
  // calculate margin
  Serial.print("Distance: ");Serial.println(pos);
  float batterymoment = mass*pos;
  Serial.println(batterymoment);
  float totalmass = mass + 12404;
  Serial.println(totalmass);
  float totalmoment = 149650+batterymoment;
  Serial.println(totalmoment);
  float buoyancymoment = buoyancymass*centrebuoyancy;
  Serial.println(buoyancymoment);
  float wheelmoment = totalmoment - buoyancymoment;
  Serial.println(wheelmoment);
  float wheelweight = totalmass - buoyancymass;
  Serial.println(wheelweight);
  float cgwheels = wheelmoment/wheelweight;
  Serial.println(cgwheels);
  float maindistance = mainarm - cgwheels;
  Serial.println(maindistance);
  float nosedistance = cgwheels - nosearm;
  Serial.println(nosedistance);
  float mainmass = (((wheelweight)*(1-((maindistance)/(maindistance+nosedistance))))/2);
  Serial.println(mainmass);
  float nosemass = (((wheelweight)*(1-((nosedistance)/(nosedistance+maindistance))))/2);
  Serial.println(nosemass);
  float mainmoment = mainmass*mainarm;
  Serial.println(mainmoment);
  float nosemoment = nosemass*nosearm;
  Serial.println(nosemoment);
  float netmoment = buoyancymoment+(mainmoment*2)+(nosemoment*2);
  Serial.println(netmoment);
  float netcg = netmoment/totalmass;
  Serial.println(netcg);
  float staticmargin = adc - netcg;
  Serial.println(staticmargin);
  float answer = staticmargin/meanadc;
  Serial.println(answer);
  float percentage = answer*100;
  Serial.print(percentage); Serial.println("%");
  float result = answer;
  return result;
}

boolean check_margin(float test_margin) {
  if (test_margin > -0.04 && test_margin < -0.02)
    return true;
  return false;
}

float armcalc(float mass) {
  for(float x=0;x<MAX_LEN;x+=MIN_INCREMENT) {
    // calculate margin
    float margin = calc_margin(x,mass);
    if (check_margin(margin)) {
      return x;
    }
  }
  return -1;
}

float stepcalc(float arm){
  int arminch = arm*12;
  float numberofsteps = arminch/stepinch;
  int result = numberofsteps;
  Serial.print("Calculated steps: "); Serial.println(result);
  return result;
}


void loop() {
  // read input
  Serial.println("Enter mass: ");
  while (!Serial.available());
  float mass = Serial.parseFloat();
  float arm = armcalc(mass);
  if (arm < 0) {
    // Error message
    Serial.println("Error!");
    return;
  }
  Serial.print("Arm distance is "); Serial.println(arm);
  // step
  const int steplength = (int) stepcalc(arm);
  Serial.print("Number of steps is "); Serial.println(steplength);
  myStepper.step(-steplength);

  while(1);

}


user19013: These drivers differ from the H-Bridge-design described here. You don't need to generate pulses for the coils, as you would do with a classic H-Bridge.

Connect your motor to A+, A-, B+, B- (a is one coil, b the other)

Connect Power (guess 12+ volts, mine take up to 48V) to GND and V+

Either connect 5V to ENA+(+5V) or a free arduino Pin and ENA-(ENA) to GND. This pin enables/disables the driver. If no input is present at this pin, the driver will not work.

Connect DIR+(+5V) to a free arduino pin and DIR-(DIR) to GND. This pin controls the direction. HIGH makes the motor turn right, while LOW on this pin makes the motor turn left.

Connect PUL+(+5V) to a free arduino pin and PUL-(PUL) to GND. This pin controls the speed. The more pulses/second one applies, the faster the motor turns. (Up to a limit, of course).


Sketch should be easy.
Plus: You could turn around the control connections, by hardwiring all +5V pins to 5V and use INPUT_PULLUP to switch the current flow on the negative lines. I know that these drivers are optical isolated and draw as little as 10 mA from a pin, if at all. So you should be safe.

19111: <p>I'm having trouble using the ENABLE pin on my microstepper driver, I'm not sure of the exact model but it looks exactly like the one pictured here</p>

<p><a href="http://www.driver-motor.com/UploadFile/ProductImage/1/5/20090328230757_%E7%85%A7%E7%89%87-005.jpg" rel="nofollow">Microstepper Driver</a></p>

<p>Here's my code:</p>

<pre><code>#define MAX_LEN 8
#define MIN_INCREMENT 0.5
#define LIMIT_SWITCH 3
#define ENABLE 10
float buoyancymass = 4401.425;
float centrebuoyancy = 14.164;
float mainarm = 14.3;
float nosearm = 1.8;
float adc = 11.4;
float meanadc = 22.65; 
volatile byte enable_state = LOW;


#include &lt;Stepper.h&gt;

const int stepsPerRevolution = 1600;  // 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);

int stepCount = 0;         // number of steps the motor has taken
float stepinch = 0.00524; // 1 step = x"

void setup() {
  // initialize the serial port:
  Serial.begin(9600);
  pinMode(LIMIT_SWITCH, INPUT_PULLUP);
  pinMode(ENABLE, OUTPUT);
  //enable motor
  digitalWrite(ENABLE, enable_state);
  //interrupt
  attachInterrupt(digitalPinToInterrupt(LIMIT_SWITCH), limitbrake, FALLING);
  // set the speed
  myStepper.setSpeed(30);
}

void limitbrake() {
  digitalWrite(ENABLE, !enable_state);
}
</code></pre>

<p>The problem I'm noticing is that when I set the <code>pinMode(ENABLE,OUTPUT);</code> my stepper doesn't draw current and therefor, doesn't drive. This occurs regardless of whether I set my <code>enable_state</code> to HIGH or LOW.</p>

<p>Funny enough, when I set it to <code>pinMode(ENABLE,INPUT);</code> it does draw current and drive the motor, but unfortunately my limit switch which I've attached an interrupt to doesn't disable the motor when its pressed. </p>

<p>Before you ask, I've tested the enable pin on my driver and my limit switch circuitry in other programs and they both work. I'm just having trouble with putting it together. </p>

<p>Here is the rest of my code if you were wondering. </p>

<pre><code>float calc_margin(float pos, float mass) {
  // calculate margin
  Serial.print("Distance: ");Serial.println(pos);
  float batterymoment = mass*pos;
  Serial.println(batterymoment);
  float totalmass = mass + 12404;
  Serial.println(totalmass);
  float totalmoment = 149650+batterymoment;
  Serial.println(totalmoment);
  float buoyancymoment = buoyancymass*centrebuoyancy;
  Serial.println(buoyancymoment);
  float wheelmoment = totalmoment - buoyancymoment;
  Serial.println(wheelmoment);
  float wheelweight = totalmass - buoyancymass;
  Serial.println(wheelweight);
  float cgwheels = wheelmoment/wheelweight;
  Serial.println(cgwheels);
  float maindistance = mainarm - cgwheels;
  Serial.println(maindistance);
  float nosedistance = cgwheels - nosearm;
  Serial.println(nosedistance);
  float mainmass = (((wheelweight)*(1-((maindistance)/(maindistance+nosedistance))))/2);
  Serial.println(mainmass);
  float nosemass = (((wheelweight)*(1-((nosedistance)/(nosedistance+maindistance))))/2);
  Serial.println(nosemass);
  float mainmoment = mainmass*mainarm;
  Serial.println(mainmoment);
  float nosemoment = nosemass*nosearm;
  Serial.println(nosemoment);
  float netmoment = buoyancymoment+(mainmoment*2)+(nosemoment*2);
  Serial.println(netmoment);
  float netcg = netmoment/totalmass;
  Serial.println(netcg);
  float staticmargin = adc - netcg;
  Serial.println(staticmargin);
  float answer = staticmargin/meanadc;
  Serial.println(answer);
  float percentage = answer*100;
  Serial.print(percentage); Serial.println("%");
  float result = answer;
  return result;
}

boolean check_margin(float test_margin) {
  if (test_margin &gt; -0.04 &amp;&amp; test_margin &lt; -0.02)
    return true;
  return false;
}

float armcalc(float mass) {
  for(float x=0;x&lt;MAX_LEN;x+=MIN_INCREMENT) {
    // calculate margin
    float margin = calc_margin(x,mass);
    if (check_margin(margin)) {
      return x;
    }
  }
  return -1;
}

float stepcalc(float arm){
  int arminch = arm*12;
  float numberofsteps = arminch/stepinch;
  int result = numberofsteps;
  Serial.print("Calculated steps: "); Serial.println(result);
  return result;
}


void loop() {
  // read input
  Serial.println("Enter mass: ");
  while (!Serial.available());
  float mass = Serial.parseFloat();
  float arm = armcalc(mass);
  if (arm &lt; 0) {
    // Error message
    Serial.println("Error!");
    return;
  }
  Serial.print("Arm distance is "); Serial.println(arm);
  // step
  const int steplength = (int) stepcalc(arm);
  Serial.print("Number of steps is "); Serial.println(steplength);
  myStepper.step(-steplength);

  while(1);

}
</code></pre>
 19013: <p>These drivers differ from the H-Bridge-design <a href="http://www.arduino.cc/en/Reference/StepperBipolarCircuit" rel="nofollow noreferrer">described here</a>. You don't need to generate pulses for the coils, as you would do with a classic H-Bridge.</p>
<ol>
<li><p>Connect your motor to <code>A+</code>, <code>A-</code>, <code>B+</code>, <code>B-</code> (a is one coil, b the other)</p>
</li>
<li><p>Connect Power (guess 12+ volts, mine take up to 48V) to <code>GND</code> and <code>V+</code></p>
</li>
<li><p>Either connect 5V to <code>ENA+(+5V)</code> or a free arduino Pin and <code>ENA-(ENA)</code> to GND. This pin enables/disables the driver. If no input is present at this pin, the driver will not work.</p>
</li>
<li><p>Connect <code>DIR+(+5V)</code> to a free arduino pin and <code>DIR-(DIR)</code> to <code>GND</code>. This pin controls the direction. <code>HIGH</code> makes the motor turn right, while <code>LOW</code> on this pin makes the motor turn left.</p>
</li>
<li><p>Connect <code>PUL+(+5V)</code> to a free arduino pin and <code>PUL-(PUL)</code> to <code>GND</code>. This pin controls the speed. The more pulses/second one applies, the faster the motor turns. (Up to a limit, of course).</p>
</li>
</ol>
<p>Sketch should be easy.</p>
<p><strong>Plus</strong>: You could turn around the control connections, by hardwiring all <code>+5V</code> pins to 5V and use <code>INPUT_PULLUP</code> to switch the current flow on the negative lines. I know that these drivers are optical isolated and draw as little as 10 mA from a pin, if at all. So you should be safe.</p>
