The unmodified robot control sketch, Lesson18HBridgeMotorIRControl.ino, is intended to be enhanced by the student. One such enhancement is the ability to turn gracefully. Lesson18HBridgeMotorIRControl.ino provides only spin right and spin left for changing direction. Students will quickly discover this makes precise control of robot direction difficult.
One enhancement to control is the ability to pivot in a particular direction. A "pivot" is the holding of the inside wheel still while turning the outside wheel. This PowerPoint presentation may be used to walk students through adding pivot right forward to their robot control sketch. This activity, then, may be used as a pattern for adding other control features.
Here's an example of Pivot Right in use:
By using analogWrite() to slow rather than stop the inside wheel, the robot can be made to turn. Here is an example of turning left:
Notice the LEDs changing color in response to messages sent to the rolling robot. These are smart LEDs (NeoPixels) from Adafruit. Here's a more obvious example: