 /* This example shows basic use of the AMIS-30543 stepper motor
 driver.
 
-It shows how to initialize the dirver, set the current limit, set
+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 step pin to get the driver to take steps and
-how to switch directions over SPI.  The DO and DIR pins are not
-used and do not need to be connected.
+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

  delay(300);

  // Step in the other direction 1000 times.
  stepper.setDirection(1);
  for (unsigned int x = 0; x < 1000; x++)
  {
    step();

  delay(300);
}

// Sends a pulse on the NXT/STEP pin to tell the driver to take
// one step, and also delays to control the speed of the motor.
void step()
{
  // The NXT/STEP minimum high pulse width is 2 microseconds.
  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.  If
  // you decrease the delay, the stepper motor will go fast, but
  // there is a limit to how fast it can go before it starts
  // missing steps.
  delayMicroseconds(2000);
}

// Writes a high or low value to the direction pin to specify
// what direction to turn the motor.
void setDirection(bool dir)
{
  // The NXT/STEP pin must not change for at least 0.5
  // microseconds before and after changing the DIR pin.
  delayMicroseconds(1);
  digitalWrite(amisDirPin, dir);
  delayMicroseconds(1);
}
