-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added idle() method to power down a motor to save energy or allow manual rotation of motor #11
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Stepper.cpp - Stepper library for Wiring/Arduino - Version 1.1.0 | ||
* Stepper.cpp - Stepper library for Wiring/Arduino - Version 1.1.1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Version is actually already at 1.1.3. A non-breaking API change should bump the minor version so the next release would be 1.2.0. But I think it's best to let Arduino handle the versioning since you don't necessarily want a version bump for every commit, only every release. |
||
* | ||
* Original library (0.1) by Tom Igoe. | ||
* Two-wire modifications (0.2) by Sebastian Gassner | ||
|
@@ -8,6 +8,7 @@ | |
* High-speed stepping mod by Eugene Kozlenko | ||
* Timer rollover fix by Eugene Kozlenko | ||
* Five phase five wire (1.1.0) by Ryan Orendorff | ||
* add idle method (1.1.1) by Darren Clark | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See previous comment regarding version. |
||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
|
@@ -356,10 +357,33 @@ void Stepper::stepMotor(int thisStep) | |
} | ||
} | ||
|
||
/* | ||
idle() power down the pins (may lose count): | ||
*/ | ||
void Stepper::idle(void) { | ||
if (this->pin_count == 2) { | ||
digitalWrite(motor_pin_1, LOW); | ||
digitalWrite(motor_pin_2, LOW); | ||
} | ||
if (this->pin_count == 4) { | ||
digitalWrite(motor_pin_1, LOW); | ||
digitalWrite(motor_pin_2, LOW); | ||
digitalWrite(motor_pin_3, LOW); | ||
digitalWrite(motor_pin_4, LOW); | ||
} | ||
if (this->pin_count == 5) { | ||
digitalWrite(motor_pin_1, LOW); | ||
digitalWrite(motor_pin_2, LOW); | ||
digitalWrite(motor_pin_3, LOW); | ||
digitalWrite(motor_pin_4, LOW); | ||
digitalWrite(motor_pin_5, LOW); | ||
} | ||
} | ||
|
||
/* | ||
version() returns the version of the library: | ||
*/ | ||
int Stepper::version(void) | ||
{ | ||
return 5; | ||
return 6; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See previous comment regarding version. |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
* High-speed stepping mod by Eugene Kozlenko | ||
* Timer rollover fix by Eugene Kozlenko | ||
* Five phase five wire (1.1.0) by Ryan Orendorff | ||
* add idle method (1.1.1) by Darren Clark | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See previous comment regarding version. |
||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
|
@@ -95,6 +96,9 @@ class Stepper { | |
|
||
// mover method: | ||
void step(int number_of_steps); | ||
|
||
// idle method: | ||
void idle(void); | ||
|
||
int version(void); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to use a true tab separator between the keyword and identifier, not spaces.