You are on page 1of 2

Questions

1. What are some of the symptoms of brownout on the BOE Shield-Bot? it


would go in a completely unexpected direction, but it would stop momentarily first.
2. What is a reset? when you press the reset button or disconnect it from the power
source.
3. How can a piezospeaker be used to announce that brownout just occurred?
you can add a statement at the beginning of your code to play a code when a blowout occurs
4. What function makes the speaker play tones? the tone function
5. Whats a hertz? Whats its abbreviation? a unit of frequency of one cycle per second,
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. tone(4, 6000, 2000)
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. tone(4, 2000,
900)

Projects
1. Modify the TestServoSpeed sketch so that it makes a tone signifying each
test is complete.

#include <Servo.h> // Include servo library

Servo servoLeft; // Declare left servo signal


Servo servoRight; // Declare right servo
signal

void setup() // Built in initialization


block
{
tone(4, 3000, 1000); // Play tone for 1 second
delay(1000); // Delay to finish tone

Serial.begin(9600); // Set data rate to 9600 bps


servoLeft.attach(13); // Attach left signal to P13
}

void loop() // Main loop auto-repeats


{

// Loop counts with pulseWidth from 1375 to 1625 in increments of 25.

for(int pulseWidth = 1375; pulseWidth <= 1625; pulseWidth += 25)


{
Serial.print("pulseWidth = "); // Display pulseWidth value
Serial.println(pulseWidth);
Serial.println("Press a key and click"); // User prompt
Serial.println("Send to start servo...");

while(Serial.available() == 0); // Wait for character


Serial.read(); // Clear character

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, 6000, 900)

}
}

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.
3.

You might also like