Challenge - 5 Problems
Buzzer Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Output of code using an active buzzer
What will be the output behavior of this Arduino code snippet when connected to an active buzzer on pin 9?
Arduino
void setup() {
pinMode(9, OUTPUT);
}
void loop() {
digitalWrite(9, HIGH);
delay(1000);
digitalWrite(9, LOW);
delay(1000);
}Attempts:
2 left
💡 Hint
Active buzzers only need HIGH or LOW signals to turn on or off.
✗ Incorrect
Active buzzers generate sound when powered HIGH and stop when LOW. The code turns the buzzer on for 1 second and off for 1 second repeatedly.
❓ Predict Output
intermediate2:00remaining
Output of code using a passive buzzer
What sound behavior will this Arduino code produce when connected to a passive buzzer on pin 9?
Arduino
void setup() {
pinMode(9, OUTPUT);
}
void loop() {
tone(9, 1000);
delay(1000);
noTone(9);
delay(1000);
}Attempts:
2 left
💡 Hint
Passive buzzers need a frequency signal to produce sound.
✗ Incorrect
Passive buzzers require a frequency signal generated by tone() to produce sound. The code plays a 1000 Hz tone for 1 second, then silence for 1 second.
🧠 Conceptual
advanced2:00remaining
Key difference between passive and active buzzers
Which statement correctly describes the main difference between a passive and an active buzzer?
Attempts:
2 left
💡 Hint
Think about which buzzer has a built-in sound generator.
✗ Incorrect
Active buzzers contain a built-in oscillator and sound automatically when powered. Passive buzzers need an external frequency signal to create sound.
🔧 Debug
advanced2:00remaining
Why does this passive buzzer code produce no sound?
This Arduino code is intended to make a passive buzzer beep, but it produces no sound. What is the problem?
Arduino
void setup() {
pinMode(9, OUTPUT);
}
void loop() {
digitalWrite(9, HIGH);
delay(1000);
digitalWrite(9, LOW);
delay(1000);
}Attempts:
2 left
💡 Hint
Passive buzzers need a changing signal to vibrate and produce sound.
✗ Incorrect
Passive buzzers require a frequency signal like tone() to vibrate and create sound. Simply powering the pin HIGH or LOW does not generate sound.
🚀 Application
expert3:00remaining
Designing a circuit with both buzzers
You want to design an Arduino project that uses both an active and a passive buzzer. Which approach correctly handles both buzzers in code?
Attempts:
2 left
💡 Hint
Remember how each buzzer type produces sound differently and needs different signals.
✗ Incorrect
Active buzzers only need HIGH/LOW signals, while passive buzzers need frequency signals from tone(). They should be connected to separate pins and controlled accordingly.
