Public Member Functions | List of all members
MultiStepper Class Reference

Operate multiple AccelSteppers in a co-ordinated fashion. More...

#include <MultiStepper.h>

Public Member Functions

 MultiStepper ()
boolean addStepper (AccelStepper &stepper)
void moveTo (long absolute[])
boolean run ()
void runSpeedToPosition ()

Detailed Description

Operate multiple AccelSteppers in a co-ordinated fashion.

This class can manage multiple AccelSteppers (up to MULTISTEPPER_MAX_STEPPERS = 10), and cause them all to move to selected positions at such a (constant) speed that they all arrive at their target position at the same time. This can be used to support devices with multiple steppers on say multiple axes to cause linear diagonal motion. Suitable for use with X-Y plotters, flatbeds, 3D printers etc to get linear straight line movement between arbitrary 2d (or 3d or ...) positions.

Caution: only constant speed stepper motion is supported: acceleration and deceleration is not supported All the steppers managed by MultiStepper will step at a constant speed to their target (albeit perhaps different speeds for each stepper).

Member Function Documentation

boolean MultiStepper::addStepper ( AccelStepper stepper)

Add a stepper to the set of managed steppers There is an upper limit of MULTISTEPPER_MAX_STEPPERS = 10 to the number of steppers that can be managed

[in]stepperReference to a stepper to add to the managed list
true if successful. false if the number of managed steppers would exceed MULTISTEPPER_MAX_STEPPERS
void MultiStepper::moveTo ( long  absolute[])

Set the target positions of all managed steppers according to a coordinate array. New speeds will be computed for each stepper so they will all arrive at their respective targets at very close to the same time.

[in]absoluteAn array of desired absolute stepper positions. absolute[0] will be used to set the absolute position of the first stepper added by addStepper() etc. The array must be at least as long as the number of steppers that have been added by addStepper, else results are undefined.

References AccelStepper::currentPosition(), AccelStepper::maxSpeed(), AccelStepper::moveTo(), and AccelStepper::setSpeed().

boolean MultiStepper::run ( )

Calls runSpeed() on all the managed steppers that have not acheived their target position.

true if any stepper is still in the process of running to its target position.

References AccelStepper::runSpeed().

Referenced by runSpeedToPosition().

void MultiStepper::runSpeedToPosition ( )

Runs all managed steppers until they acheived their target position. Blocks until all that position is acheived. If you dont want blocking consider using run() instead.

References run().

The documentation for this class was generated from the following files: