mirror of
https://github.com/KevinMidboe/python-gpiozero.git
synced 2025-10-29 17:50:37 +00:00
Merge pull request #96 from waveform80/pwm-toggle-motor-reverse
Fix #91
This commit is contained in:
@@ -360,6 +360,16 @@ class Robot(SourceMixin, CompositeDevice):
|
||||
self._left.forward(speed)
|
||||
self._right.backward(speed)
|
||||
|
||||
def reverse(self):
|
||||
"""
|
||||
Reverse the robot's current motor directions. If the robot is currently
|
||||
running full speed forward, it will run full speed backward. If the
|
||||
roboto is turning left at half-speed, it will turn right at half-speed.
|
||||
If the robot is currently stopped it will remain stopped.
|
||||
"""
|
||||
self._left.value = -self._left.value
|
||||
self._right.value = -self._right.value
|
||||
|
||||
def stop(self):
|
||||
"""
|
||||
Stop the robot.
|
||||
|
||||
Reference in New Issue
Block a user