CHAPTER 25 ■ LAUNCHING THE LINE-FOLLOWER
Having a motor spin backwards is the most common mistake in building this robot. It’s confusing
since one motor has to spin in the opposite direction than the other motor. Think about it this way: the tops
of both motors must spin toward the front of the robot to move forward.
If both motors spin in the wrong direction, try swapping them to the opposite Molex connector headers
on the board (so the left motor housing is attached to the right header connector on the board, and vice
versa). Depending on how you wired the circuit, this may fix the problem. If that doesn’t work, use a tiny
screwdriver to pop both terminals out of each motor connector housing and re-insert the wires in the
opposite order.
If only one motor spins in the wrong direction, you’ve got two possibilities. If the order of the terminals
in the Molex connector housing of the “bad” motor are the opposite of the “good” motor, then pop and flip
the terminals of the “bad” motor. However, if both motors are wired the same way, then the Molex header on
the circuit board that connects to the “bad” motor should have its wires desoldered and flipped around.
Determining the Light and Dark Positions of the Line-Following Switch
- Toggle the line-following switch to the left.
- Place a dark piece of paper under the right side of the robot’s sensors. The left
brightness LEDs should be lit up.
If the left motor spins, then the line-following switch is in the position to follow dark lines. If the right
motor spins, then the line-following switch is in the position to follow light lines.
- Toggle the line-following switch to the right. The opposite motor should spin.
If the same motor spins as when the switch was toggled in the opposite direction, then the line-
following switch is miswired. Most likely the motor wires don’t diagonally cross over the center of the switch.
- Label which position of the line-following switch is for light lines and which for
dark lines.
To label the switch, I printed and cut out a 2 cm square piece of paper (see Figure 25-3).
Figure 25-2. The robot’s right motor spins clockwise