-
Notifications
You must be signed in to change notification settings - Fork 2
Reference
Note that library use one pre-declared object, StepperDriver (it looks like usage of Serial in Arduino).
Run this function once in the setup(). It performs initialization of hardware timer.
Arguments: No arguments.
Return value: Nothing.
Example:
void setup() {
StepperDriver.init();
}
Creates new axis which uses pins from arguments list. Returns the index of newly registered axis, you need to save it for control.
Arguments:
- int step: number of pin where STEP signal for axis is connected;
- int dir: number of pin where DIR signal is connected;
- int enable (optional): number of pin where ENABLE signal is connected (if driver has it).
_Return value: axis_t, index of registered axis.
Example:
axis_t my_motor;
void setup() {
StepperDriver.init();
my_motor = StepperDriver.newAxis(1, 2, 3);
}
Enable the axis on driver level (if driver has an ENABLE channel for the axis).
Arguments: axis_t axis - index of axis to enable.
Return value: Nothing.
Example:
axis_t my_motor;
void setup() {
... /* initialization */
StepperDriver.enable(my_motor);
}
Disable the axis on driver level (if driver has an ENABLE channel for the axis).
Arguments: axis_t axis - index of axis to disable.
Return value: Nothing.
Example:
axis_t my_motor;
... /* initialization */
void loop() {
... /* some profitful work */
if (need_to_disable)
StepperDriver.disable(my_motor);
}
Set rotation direction for this axis (variants are defined: FORWARD and BACKWARD).
Arguments:
- axis_t axis: index of axis to set direction;
- int dir: FORWARD or BACKWARD
Return value: Nothing.
Example:
axis_t my_motor;
... /* initialization */
void loop() {
StepperDriver.setDir(my_motor, FORWARD);
...
StepperDriver.setDir(my_motor, BACKWARD);
}