Datasheet
Chapter 4 • BOE Shield-Bot Navigation
104 • Robotics with the BOE Shield-Bot
Activity 1: Basic BOE Shield-Bot Maneuvers
Have you ever thought about what direction a car’s wheels have to turn to propel it forward?
The wheels turn opposite directions on opposite sides of the car. Likewise, to make the BOE
Shield-Bot go forward, its left wheel has to turn counterclockwise, but its right wheel has to
turn clockwise.
Remember that a sketch can use the Servo library’s
writeMicroseconds function to
control the speed and direction of each servo. Then, it can use the
delay function to keep
the servos running for certain amounts of time before choosing new speeds and directions.
Here’s an example that will make the BOE Shield-Bot roll forward for about three seconds,
and then stop.
Example Sketch: ForwardThreeSeconds
Make sure the BOE Shield’s power switch is set to 1 and the battery pack is
plugged into the Arduino.
Create and save the ForwardThreeSeconds sketch, and run it on the Arduino.
Disconnect the programing cable and put the BOE Shield-Bot on the floor.
While holding down the Reset button, move the switch to position 3, and then let go. The
BOE Shield-Bot should drive forward for three seconds.
// Robotics with the BOE Shield - ForwardThreeSeconds
// Make the BOE Shield-Bot roll forward for three seconds, then stop.
#include <Servo.h> // Include servo library
Servo servoLeft; // Declare left and right servos
Servo servoRight;
Left side
Right side
Counterclockwise forward
Clockwise forward