Bird
0
0
Arduinoprogramming~5 mins

Playing melodies with tone() in Arduino - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the tone() function do in Arduino?
It plays a sound of a specific frequency on a speaker connected to a pin, creating a tone or note.
Click to reveal answer
beginner
How do you stop a tone that is playing on a pin?
Use the noTone(pin) function to stop the sound on that pin.
Click to reveal answer
beginner
What are the three parameters of tone()?
1. The pin number where the speaker is connected.<br>2. The frequency of the tone in Hertz.<br>3. (Optional) The duration in milliseconds to play the tone.
Click to reveal answer
intermediate
Why do we use arrays when playing melodies with tone()?
Arrays store sequences of notes and their durations so the program can play melodies by looping through them.
Click to reveal answer
intermediate
What happens if you call tone() on a pin that is already playing a tone?
The new tone replaces the old one immediately on that pin.
Click to reveal answer
Which function stops a tone playing on a pin?
Atone(pin, 0)
BstopTone(pin)
CnoTone(pin)
DendTone(pin)
What does the second parameter of tone(pin, frequency) represent?
AFrequency in Hertz
BDuration in milliseconds
CPin number
DVolume level
How can you play a melody using tone()?
ABy using <code>noTone()</code> repeatedly
BBy calling <code>tone()</code> once with all notes
CBy connecting multiple speakers to different pins
DBy using arrays to store notes and durations and looping through them
What happens if you omit the duration parameter in tone()?
AThe tone plays forever until <code>noTone()</code> is called
BThe tone plays for 1 second
CThe tone does not play
DThe tone plays for 100 milliseconds
Which Arduino pin type is required to use tone()?
AAnalog input pins
BDigital output pins
CPower pins
DGround pins
Explain how you would use the tone() function to play a simple melody on an Arduino.
Think about storing notes and durations, then playing each note one by one.
You got /4 concepts.
    Describe the role of the frequency and duration parameters in the tone() function.
    Frequency is like the musical note, duration is how long you hear it.
    You got /4 concepts.