21 March 2017
Chapter 3 Challenges
Questions
1. What are some of the symptoms of brownout on the BOE Shield-Bot?
Some symptoms of brownout on the BOE Shield-Bot include erratic behavior
such as as going in unexpected directions or doing a confused dance.
2. What is a reset?
A reset is when the Arduino restarts executing a sketch from the beginning.
Resets happen when you press the reset button, take off the power, or when the arduino
recieves not enough power due to brownout.
3. How can a piezospeaker be used to announce that brownout just occurred?
If you add statements that make the piezospeaker play a tone at the beginning of
all of your sketches, itll play a tone if a brownout occurs. That way, you can know
whether to replace the batteries or check for an error in your navigation code.
4. What function makes the speaker play tones?
The tone function makes the speaker play tones.
5. Whats a hertz? Whats its abbreviation?
A hertz is a measurement of the number of times per second a signal repeats itself.
It is abbreviation Hz.
Exercises
1. Write a statement that makes a tone, one that sounds different from the start-alert tone, to
signify the end of a sketch.
2. Write a statement that plays a speaker tone to signify an intermediate step in the sketch.
This tone should be different from a start-alert or end tone.
Projects
1. Modify the TestServoSpeed sketch so that it makes a tone signifying each test is
complete.
/*
Robotics with the BOE Shield Chapter 3, Project 1
*/
Serial.println("Running...");
servoLeft.writeMicroseconds(pulseWidth); // Pin 13 servo
speed = pulse
delay(6000); // ..for 6 seconds
servoLeft.writeMicroseconds(1500); // Pin 13 servo speed
= stop
tone(4, 4000, 75); // Test complete
}
}
2. Modify the TestServoSpeed sketch so that it runs both wheels instead of just one with
each test. Make the right wheel turn the opposite direction from the left wheel.
/*
Robotics with the BOE Shield Chapter 3, Project 2
*/
Serial.println("Running...");
servoLeft.writeMicroseconds(pulseWidth); // Pin 13 servo
speed = pulse
// Pin 12 servo opposite direction of pin 13 servo.
servoRight.writeMicroseconds(1500 + (1500 - pulseWidth));
delay(6000); // ..for 6 seconds
servoLeft.writeMicroseconds(1500); // Pin 13 servo speed
= stop
servoRight.writeMicroseconds(1500); // Pin 12 servo speed
= stop
tone(4, 4000, 75); // Test complete
}
}