Steering with two motors
If we move one motor and not the other, the robot turns toward the wheel that isn’t moving. For example, look at the following diagram:
Figure 5.4 – Steering a robot with motors
Figure 5.4 shows two turning robots. There is a forward arrow above the left wheel in the first panel, showing the wheel is driving forward. The right wheel is stopped. A transparent arrow superimposed on this shows the turn direction and that this turn pivots on the right wheel. The right robot shows an opposite turn. A robot can turn backward in the same way by reversing a single motor instead.
As we will do more with motors, we’ll extend robot.py
so that we can stop them all. Add this code at the end of robot.py
:
def stop(): motor_A1.value = False motor_A2.value = False motor_B1.value = False motor_B2.value = False
Ensure you copy...