Datasheet
BOE Shield-Bot Navigation • Chapter 4
Robotics with the BOE Shield-Bot • 133
int note[] = {1047, 1147, 1319, 1397, 1568, 1760,
1976, 2093, 2349, 2637};
If you are musically inclined, try writing an array that will play a very short tune.
Navigation with Arrays
Remember the maneuver function from the last activity? Here are three arrays of values, one
for each parameter in the
maneuver function. Together, they make up the same forward-left-
right-backward-stop sequence we’ve been doing through the chapter.
// Forward left right backward stop
// index 0 1 2 3 4
int speedsLeft[] = {200, -200, 200, -200, 0};
int speedsRight[] = {200, 200, -200, -200, 0};
int times[] = {2000, 600, 600, 2000, -1};
A sketch can then use this code in one of its functions to execute all the maneuvers:
// Determine number of elements in sequence list.
int elementCount = sizeof(times) / sizeof(int);
// Fetch successive elements from each sequence list and feed them
// to maneuver function.