Recall & Review
beginner
What does the
tone() function do in Arduino?The
tone() function generates a square wave of a specified frequency on a pin, which can be used to play sounds like beeps or tones.Click to reveal answer
beginner
What are the basic parameters of the
tone() function?The basic parameters are:
pin (the output pin), frequency (in Hertz), and optionally duration (how long to play the tone in milliseconds).Click to reveal answer
beginner
How do you stop a tone generated by
tone()?Use the
noTone(pin) function to stop the tone on the specified pin.Click to reveal answer
intermediate
Can
tone() play multiple tones on different pins at the same time?No, Arduino can only generate one tone at a time. Calling
tone() on a new pin stops the previous tone.Click to reveal answer
beginner
Write a simple Arduino code snippet to play a 440 Hz tone for 1 second on pin 8.
void setup() {
tone(8, 440, 1000); // Play 440 Hz tone on pin 8 for 1000 ms
}
void loop() {
// Nothing here
}
Click to reveal answer
What does the
tone() function generate on an Arduino pin?✗ Incorrect
The
tone() function generates a square wave at the frequency you specify.Which parameter is NOT part of the
tone() function?✗ Incorrect
The
tone() function does not control volume; it only controls frequency and duration.How do you stop a tone playing on a pin?
✗ Incorrect
The
noTone(pin) function stops the tone on the specified pin.What happens if you call
tone() on a new pin while a tone is already playing?✗ Incorrect
Arduino can only play one tone at a time; the new call stops the previous tone.
Which frequency corresponds to the musical note A4, often used in tone examples?
✗ Incorrect
440 Hz is the standard frequency for the musical note A4.
Explain how to use the
tone() function to generate a sound on an Arduino pin.Think about what parameters you need and how to stop the sound.
You got /4 concepts.
Describe the limitations of the
tone() function when playing multiple sounds.Consider what happens if you try to play two tones at once.
You got /3 concepts.
