Add Function to Return Current Motor Speed
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.
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