Datasheet

Chapter 4 • BOE Shield-Bot Navigation
110 • Robotics with the BOE Shield-Bot
Place the Shield-Bot on a long stretch of smooth, bare floor.
Hold the Reset button down while you move the Power switch to 2, then let go.
Press the Reset button, then watch closely to see if your BOE Shield-Bot veers to
the right or left as it travels forward for ten seconds.
// Robotics with the BOE Shield - ForwardTenSeconds
// Make the BOE Shield-Bot roll forward for ten seconds, then stop.
#include <Servo.h> // Include servo library
Servo servoLeft; // Declare left and right servos
Servo servoRight;
void setup() // Built-in initialization block
{
tone(4, 3000, 1000); // Play tone for 1 second
delay(1000); // Delay to finish tone
servoLeft.attach(13); // Attach left signal to pin 13
servoRight.attach(12); // Attach right signal to pin 12
// Full speed forward
servoLeft.writeMicroseconds(1700); // Left wheel counterclockwise
servoRight.writeMicroseconds(1300); // Right wheel clockwise
delay(10000); // ...for 10 seconds
servoLeft.detach(); // Stop sending servo signals
servoRight.detach();
}
void loop() // Main loop auto-repeats
{ // Empty, nothing needs repeating
}
Your Turn Adjusting Servo Speed to Straighten the BOE Shield-Bot’s Path
If your BOE Shield-Bot turns slightly when you want it to go straight forward, the solution is
fairly simple. Just slow down the faster wheel. Remember from the servo transfer curve
graph that you have best speed control over the servos in the 1400 to 1600 µs range.
The us parameters in writeMicroseconds(us)
Top speed
clockwise
Linear speed
zone starts
Full stop
Linear speed
zone ends
Top speed
counterclockwise
1300 1400 1500 1600 1700