Stepper Motor 1.0
Stepper Motor Library
Stepper motor control library

This library provide control of unipolar and bipolar stepper motors through the appropriate hardware drivers.

Motions can be enabled in a polled mode for generic architectures or from an interrupt timer for AVR architectures, using either AVR timer 1 or 2 (selectable at compile time).

This library was designed for stepper control of motors used in robotic applications, running at modest step frequencies (ie the hundreds of Hz rather than KHz).

Important Notes:

  • This library uses AVR TIMER1 or TIMER2 to implement the interrupt driven clock. TIMER0 is used by the Arduino millis() clock, TIMER1 is commonly used by the Servo library and TIMER2 by the Tone library. Change USE_TIMER (defined at the top of the header file) to select which timer is enabled in the library code.
  • With ENABLE_AUTORUN disabled, this library will function on all hardware architectures but run() needs to be called each iteration through loop().
  • With ENABLE_AUTORUN enabled, This library is limited to AVR architectures and run() will be invoked by a timer ISR, effectively driving the motor managment as a background process.
  • This library has been tested on Arduino Uno and Nano (ie, 328P processor).
  • TIMERn is a global resource, so each concurrent object instance is driven from the same TIMERn interrupt. The constant MAX_INSTANCE is used to set limits the global maximum for instances allowed to be processed by the interrupt.

See Also