Datasheet

Assemble and Test your BOE Shield-Bot • Chapter 3
Robotics with the BOE Shield-Bot 97
After the Arduino receives a character from the keyboard, it displays the “Running…”
message and then makes the servo turn for 6 seconds. Remember that the
for loop this
code is in starts the
pulseWidth variable at 1375 and adds 25 to it with each repetition. So,
the first time through the loop,
servoLeft is 1375, the second time through it’s 1400, and so
on all the way up to 1625.
Each time through the loop,
servoLeft.writeMicroseconds(pulseWidth) uses the value
that
pulseWidth stores to set servo speed. That’s how it updates the servo’s speed each
time you send a character to the Arduino with the Serial Monitor.
Serial.println("Running...");
servoLeft.writeMicroseconds(pulseWidth); // Pin 13 speed=pulse
delay(6000); // ..for 6 seconds
servoLeft.writeMicroseconds(1500); // Pin 13 speed=stop
Optional: Record Your Own Transfer Curve Data
You can use the table below to record the data for your own transfer curve. The loop in the
TestServoSpeed sketch can be modified to test every value in the table, or every other value
to save time.
Change the
for statement in TestServoSpeed from:
for(int pulseWidth=1375; pulseWidth <= 1625; pulseWidth += 25)
…to:
for(int pulseWidth=1300; pulseWidth <= 1700; pulseWidth += 20)
Load the modified sketch into the Arduino and use it to fill in every other table
entry. (If you want to fill in every table entry,
use pulseWidth += 10 in the
for statement’s
increment parameter.)
Use graphing software of your choice to plot the pulse width vs. wheel RPM.
To repeat these measurements for the right wheel, replace all instances of 13
with 12 in the sketch.