Skip to content

Add Function to Return Current Motor Speed#19

Open
ronaldroe wants to merge 5 commits into
sbcshop:masterfrom
ronaldroe:master
Open

Add Function to Return Current Motor Speed#19
ronaldroe wants to merge 5 commits into
sbcshop:masterfrom
ronaldroe:master

Conversation

@ronaldroe

Copy link
Copy Markdown

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
Copy Markdown
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