Skip to content

Added support for decimal RPMs. #5777

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libraries/Stepper/src/Stepper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ Stepper::Stepper(int number_of_steps, int motor_pin_1, int motor_pin_2,
/*
* Sets the speed in revs per minute
*/
void Stepper::setSpeed(long whatSpeed)
void Stepper::setSpeed(float whatSpeed)
{
this->step_delay = 60L * 1000L * 1000L / this->number_of_steps / whatSpeed;
}
Expand Down
4 changes: 2 additions & 2 deletions libraries/Stepper/src/Stepper.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class Stepper {
int motor_pin_5);

// speed setter method:
void setSpeed(long whatSpeed);
void setSpeed(float whatSpeed);

// mover method:
void step(int number_of_steps);
Expand All @@ -102,7 +102,7 @@ class Stepper {
void stepMotor(int this_step);

int direction; // Direction of rotation
unsigned long step_delay; // delay between steps, in ms, based on speed
unsigned long step_delay; // delay between steps, in us, based on speed
int number_of_steps; // total number of steps this motor can take
int pin_count; // how many pins are in use.
int step_number; // which step the motor is on
Expand Down