Datasheet

Chapter 4 • BOE Shield-Bot Navigation
142Robotics with the BOE Shield-Bot
4. Given the data below, it should take about 3727 milliseconds to travel 36 inches:
BOE Shield-Bot speed = 11 in/s
BOE Shield-Bot distance = 36 in/s
time = (BOE Shield-Bot distance / BOE Shield-Bot speed) * (1000 ms / s)
= (36 / 11 ) * (1000)
= 3.727272…s * 1000 ms/s
≈ 3727 ms
5. Without that 20 ms (1/50
th
of a second) delay between each repetition of the
loop, it would ramp from 0 to 100 so quickly that it would seem like the BOE
Shield-Bot just stepped instantly into full speed. The ramping would not be
apparent.
6. An array.
7.
for loops and do-while loops were examples from this chapter
8.
switch/case.
9.
do{...}loop while(condition)
Exercise Solutions
1. Solution:
servoLeft.writeMicroseconds(1300);
servoRight.writeMicroseconds(1700);
delay(2500);
2. Solution:
// 30/180 = 1/6, so use 1200/6 = 200
servoLeft.writeMicroseconds(1700);
servoRight.writeMicroseconds(1700);
delay(200);
// alternate approach
servoLeft.writeMicroseconds(1700);
servoRight.writeMicroseconds(1700);
delay(1200 * 30 / 180);
// 45/180 = 1/4, so use 1200/4 = 300
servoLeft.writeMicroseconds(1700);