About
A passive buzzer requires an AC (alternating current) power source to make noise, and will not make sounds if connected to a DC voltage. This is because it needs the frequency of the power source, which oscillates back and forth, to drive the frequency of the buzzer. However, this also affords the passive buzzer more variability than the active buzzer.
Getting started
const int BUZZERPIN = 8;
void setup() {
pinMODE(BUZZERPIN, OUTPUT);
}
void loop() {
tone(BUZZERPIN, 500);
delay(200);
tone(BUZZERPIN, 1000);
delay(200);
}
Related Components