Challenge - 5 Problems
Tone Stopper Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
What is the output on the buzzer?
Consider this Arduino code snippet. What will the buzzer do when this runs?
Arduino
tone(8, 1000); // Play 1000 Hz tone on pin 8 noTone(8); // Stop the tone immediately
Attempts:
2 left
💡 Hint
noTone() stops any tone playing on the specified pin.
✗ Incorrect
The tone() function starts playing a tone on pin 8 at 1000 Hz. The noTone() function immediately stops any tone on pin 8, so the buzzer only plays briefly.
🧠 Conceptual
intermediate1:30remaining
Why use noTone() in Arduino?
Which of these best explains why you would use noTone() in an Arduino sketch?
Attempts:
2 left
💡 Hint
Think about what happens when you want silence after a sound.
✗ Incorrect
noTone() stops the tone on the pin, making the buzzer silent. It does not start or change tones or volume.
🔧 Debug
advanced2:30remaining
Why does the buzzer keep playing?
This code is supposed to play a tone and then stop it after 2 seconds, but the buzzer keeps playing. What is the problem?
Arduino
tone(9, 440); delay(2000); noTone(9);
Attempts:
2 left
💡 Hint
Check how to properly stop a tone playing on a pin.
✗ Incorrect
Calling tone(pin, 0) does not stop the tone. The correct way to stop a tone is to call noTone(pin).
📝 Syntax
advanced1:30remaining
Identify the syntax error
Which option contains the correct syntax to stop a tone on pin 7?
Attempts:
2 left
💡 Hint
Remember how functions are called in Arduino (C++).
✗ Incorrect
The correct syntax is noTone(7); with parentheses and a semicolon. Options B, C, and D are missing parentheses or semicolon or have wrong syntax.
🚀 Application
expert3:00remaining
How many times does the buzzer beep?
What is the number of beeps heard from the buzzer after running this code?
Arduino
for (int i = 0; i < 3; i++) { tone(10, 1000); delay(200); noTone(10); delay(200); }
Attempts:
2 left
💡 Hint
Each loop iteration plays one beep then stops it.
✗ Incorrect
The loop runs 3 times. Each time it plays a tone for 200 ms, then stops it and waits 200 ms. So, 3 beeps total.
