Skip to content
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 Function to Return Current Motor Speed #19

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Add Function to Return Current Motor Speed #19

wants to merge 5 commits into from

Conversation

ronaldroe
Copy link

Please see commit from Oct 21, 2019. I added a function to return current motor speed, and an array of motor speeds for linked motors.

This allows developers to capture the current speed programmatically for use in calculations. This makes using, say an analog stick on a controller easier to work with.

Usage:
Single motor getSpeed() returns integer speed value.
Linked motor getSpeed() returns array of integer speed values.

Example:

motor1 = PiMotor.Motor("MOTOR1")
motor2 = PiMotor.Motor("MOTOR2")

motors = PiMotor.LinkedMotors(motor1, motor2)

motor1.forward(100)
print(motor1.getSpeed()) #prints speed for motor 1 (100)

motors.forward(50)
print(motors.getSpeed()) #prints array of motor speeds ([50, 50])

There's also some changes where I commented out the print(). Please ignore that. I was trying to reduce output so I could work on a bug in another script.

@ronaldroe
Copy link
Author

Are the owners of this library active? There's 4 open PRs, and several unanswered issues.

Maybe it's time to let the community run this if the owners aren't willing to

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant