diff options
author | David A. Mellis <d.mellis@arduino.cc> | 2008-07-08 02:34:38 +0000 |
---|---|---|
committer | David A. Mellis <d.mellis@arduino.cc> | 2008-07-08 02:34:38 +0000 |
commit | 1342c837d4915cbd109321ca8b38df4f8cd03ce0 (patch) | |
tree | f21c8ed8d70408a86496847f1fb80d9540846f14 /libraries | |
parent | 6bc00d87b802421686ffc6dad4259095a6655745 (diff) |
Moving actual stepping to the end of the step() function so that the first step isn't in the wrong direction.
Diffstat (limited to 'libraries')
-rw-r--r-- | libraries/Stepper/Stepper.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libraries/Stepper/Stepper.cpp b/libraries/Stepper/Stepper.cpp index b10f94c..d5c16a3 100644 --- a/libraries/Stepper/Stepper.cpp +++ b/libraries/Stepper/Stepper.cpp @@ -132,8 +132,6 @@ void Stepper::step(int steps_to_move) while(steps_left > 0) { // move only if the appropriate delay has passed: if (millis() - this->last_step_time >= this->step_delay) { - // step the motor to step number 0, 1, 2, or 3: - stepMotor(this->step_number % 4); // get the timeStamp of when you stepped: this->last_step_time = millis(); // increment or decrement the step number, @@ -152,6 +150,8 @@ void Stepper::step(int steps_to_move) } // decrement the steps left: steps_left--; + // step the motor to step number 0, 1, 2, or 3: + stepMotor(this->step_number % 4); } } } |