 
 const uint8_t amisSlaveSelect = 4;
 const uint8_t amisStepPin = 5;
+const uint8_t amisDirPin = 6;
 
 AMIS30543 stepper;
 
 void setup()
 {
   SPI.begin();
+  stepper.init(amisSlaveSelect);
+
+  // Drive the NXT/STEP and DIR pins low initially.
+  digitalWrite(amisStepPin, LOW);
   pinMode(amisStepPin, OUTPUT);
+  digitalWrite(amisDirPin, LOW);
+  pinMode(amisDirPin, OUTPUT);
+
+  // Give the driver some time to power up.
   delay(1);
 
-  stepper.init(amisSlaveSelect);
+  // Reset the driver to its default settings.
   stepper.resetSettings();
-  stepper.setCurrentMilliamps(245);
+
+  // Set the current limit.  You should change the number here to
+  // an appropriate value for your particular system.
+  stepper.setCurrentMilliamps(135);
+
+  // Set the number of microsteps that correspond to one full step.
   stepper.setStepMode(32);
+
+  // Enable the motor outputs.
   stepper.enableDriver();
 }
 
 void loop()
 {
   // Step in the default direction 1000 times.
-  stepper.setDirection(0);
+  setDirection(0);
   for (unsigned int x = 0; x < 1000; x++)
   {
     step();

  delay(300);
}

void step()
{
  // Send a pulse on the NXT/STEP pin to tell the driver to take one step.
  digitalWrite(amisStepPin, HIGH);
  delayMicroseconds(3);
  digitalWrite(amisStepPin, LOW);
  delayMicroseconds(3);

  // The delay here controls the stepper motor's speed.  You can
  // increase the delay to make the stepper motor go slower.
  delayMicroseconds(2000);
}

/* This example shows basic use of the AMIS-30543 stepper motor
driver.

It shows how to initialize the driver, set the current limit, set
the micro-stepping mode, and enable the driver.  It shows how to
send pulses to the NXT/STEP pin to get the driver to take steps
and how to switch directions using the DIR pin.  The DO pin is
not used and does not need to be connected.

Before using this example, be sure to change the
setCurrentMilliamps line to have an appropriate current limit for
