Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

adding a couple more convenience methods to multistepper

  • Loading branch information...
commit 6742fac75297d6733596ddac652dd3cb949bb530 1 parent 0a9bc42
@smike authored
View
16 libraries/Stepper/MultiStepper.cpp
@@ -46,6 +46,22 @@ void MultiStepper::setHold(bool hold)
}
}
+void MultiStepper::setDirectionPositive(bool direction_positive)
+{
+ uint8_t num_motors = numMotors();
+ for (uint8_t i = 0; i < num_motors; i++) {
+ this->steppers[i]->setDirectionPositive(direction_positive);
+ }
+}
+
+void MultiStepper::setStepsToMove(unsigned int steps_to_move)
+{
+ uint8_t num_motors = numMotors();
+ for (uint8_t i = 0; i < num_motors; i++) {
+ this->steppers[i]->setStepsToMove(steps_to_move);
+ }
+}
+
void MultiStepper::step(int steps_to_move) {
uint8_t num_motors = numMotors();
int steps_to_move_array[num_motors];
View
5 libraries/Stepper/MultiStepper.h
@@ -44,6 +44,11 @@ class MultiStepper {
// Set the drive type for all motors.
void setDriveType(Stepper::DriveType drive_type);
+ void setDirectionPositive(bool direction_positive);
+
+ // sets a limit on how many steps should be moved
+ void setStepsToMove(unsigned int steps_to_move);
+
// mover methods:
// Move all motors the number_of_steps
// Note that steps_to_move is an integer, with a max value of 2^15-1
Please sign in to comment.
Something went wrong with that request. Please try again.