Datasheet

BOE Shield-Bot Navigation • Chapter 4
Robotics with the BOE Shield-Bot 139
case 'h': // c contains 'h'
servoLeft.writeMicroseconds(1550); // Half speed forward
servoRight.writeMicroseconds(1450);
break;
Add ten or so h characters to your maneuvers character array. Keep in mind
that they have to be added to the left of the
s character for the sketch to get to
them.
Experiment a little, and add another
case statement for a different maneuver,
such as pivot-backward-left, then add some characters for the new maneuver to
your array string. Can you see how this is a convenient way to build sequences of
maneuvers?
Chapter 4 Summary
This chapter was all about robot navigation, experimenting with many different
programming approaches and employing some robotics and engineering skills:
Programming
Simplifying navigation by creating custom functions for frequently-used
maneuver code, and how to call those functions
How to use counted
for loops with step increments in maneuver code
What parameters are, and how to write functions and function calls that use them
How a local variable can be created as a parameter in a function declaration
How to declare, initialize, and use the Arduino language’s
int and char arrays,
taking advantage of the Arduino library’s
sizeof function
How to manage program flow control, using
do-while and switch/case
How to use the post increment operator (
++) in conditional loops
How to use the not-equal comparison operator (
!=) as a condition in a loop
Writing sketches to play a sequence of notes on the piezospeaker
Writing sketches using several different program strategies to perform the same
maneuver sequences
Robotics Skills
How basic rolling-robot maneuvers are accomplished by controlling wheel speed
and direction
What the differences are between gradual turns, pivot-turns, and rotating-in-
place turns, and what wheel speed/direction combinations make these turns.
What speed ramping is, how to use it so your robot moves smoothly into and out
of maneuvers, and how ramping is beneficial to your BOE Shield-Bot
What dead reckoning is, in the context of entry-level robotics navigation