PropWare
C++ objects and CMake build system for Parallax Propeller
|
4-phase stepper motor driver More...
#include <stepper.h>
Public Member Functions | |
Stepper (const Pin::Mask phase1Mask, const Pin::Mask phase2Mask, const Pin::Mask phase3Mask, const Pin::Mask phase4Mask, const Step start=ZERO) | |
Constructor. More... | |
void | step_forward (unsigned int steps, const unsigned int usDelay=DEFAULT_DELAY) |
Move the motor forward by a specified number of steps. More... | |
void | step_reverse (unsigned int steps, const unsigned int usDelay=DEFAULT_DELAY) |
Move the motor backward by a specified number of steps. More... | |
Static Public Attributes | |
static const unsigned int | DEFAULT_DELAY = 10000 |
Default delay in microseconds used between each step. | |
4-phase stepper motor driver
This driver always runs in full-torque, full-step mode. An excellent animated GIF of how 4-phase stepper motors work can be found here: http://www.piclist.com/images/www/hobby_elec/gif/step_motor1_2.gif
The code for this driver was taken directly from Parallax Javelin code and tweaked to work with PropWare's classes: https://www.parallax.com/sites/default/files/downloads/27964-Stepper-Motor-Documentation.pdf
PropWare::Stepper::Stepper | ( | const Pin::Mask | phase1Mask, |
const Pin::Mask | phase2Mask, | ||
const Pin::Mask | phase3Mask, | ||
const Pin::Mask | phase4Mask, | ||
const Step | start = ZERO |
||
) |
Constructor.
[in] | phase1Mask | Pin mask connected to phase 1 |
[in] | phase2Mask | Pin mask connected to phase 2 |
[in] | phase3Mask | Pin mask connected to phase 3 |
[in] | phase4Mask | Pin mask connected to phase 4 |
[in] | start | What step should the motor start with |
Definition at line 66 of file stepper.h.
void PropWare::Stepper::step_forward | ( | unsigned int | steps, |
const unsigned int | usDelay = DEFAULT_DELAY |
||
) |
Move the motor forward by a specified number of steps.
[in] | steps | Number of steps to move forward |
[in] | usDelay | Delay in microseconds between steps (must be greater than 17) |
void PropWare::Stepper::step_reverse | ( | unsigned int | steps, |
const unsigned int | usDelay = DEFAULT_DELAY |
||
) |
Move the motor backward by a specified number of steps.
[in] | steps | Number of steps to move backward |
[in] | usDelay | Delay in microseconds between steps (must be greater than 17) |
Definition at line 107 of file stepper.h.