-
Notifications
You must be signed in to change notification settings - Fork 302
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
Add StepperMotor #757
base: master
Are you sure you want to change the base?
Add StepperMotor #757
Conversation
Codecov Report
@@ Coverage Diff @@
## master #757 +/- ##
==========================================
- Coverage 79.46% 78.17% -1.29%
==========================================
Files 23 23
Lines 4470 4568 +98
Branches 650 669 +19
==========================================
+ Hits 3552 3571 +19
- Misses 863 942 +79
Partials 55 55
Continue to review full report at Codecov.
|
Thanks. Just some quick feedback (without having looked at the underlying code, which I'll try to do later...) IMHO having an I'm not sure about a |
Hello I've rename the For a user-friendly Now it is the example code: from time import sleep
from gpiozero import BasicStepperMotor
motor = BasicStepperMotor() # Set pins=() if you are using another.
motor.forward_steps(100) # Move 100 steps
motor.backward(2) # Move unlimited time at x2 speed
sleep(3)
motor.cleanup() # Stop motor and shut down pins. |
Thanks. motor.backward(2) If you look at the docs for the existing Motor class you'll see that the speed ranges from 0 (stopped) to 1 (full speed), with values inbetween indicating different speeds (e.g. 0.5 for half maximum speed). Would it be possible for you to tweak your code to match that "API" too? |
Hello |
Hello from time import sleep
from gpiozero import StepperMotor, BasicStepperMotor
motor = BasicStepperMotor()
motor.forward(speed=0.1)
sleep(2)
motor.backward()
sleep(2)
motor.stop() # Stop motor
Sorry, it's for the first example I wrote, which uses later the same pins for other test. |
Hello:
This is a suggestion to add a StepperMotor class to the library. It is based on this code with some improvements and tested using this motor.
Some examples: