Active buzzer. Always use S pin to trigger sound.
| Pin | Signal | Description |
|---|---|---|
- |
ground | |
+ |
power VCC | positive 3.3V to 5.5V |
S |
digital 3.3V to 5V | signal |
| From | To | Wire |
|---|---|---|
board:GND |
x1:- |
black |
board:5V |
x1:+ |
red |
board:D8 |
x1:S |
green |
This example was written and compile-checked for the arduino-uno. Codey Online adapts it to any other supported board for you.
// Canonical example for Active Buzzer Module
// Connect the module: - -> GND, + -> 5V, S -> D8
const int buzzerPin = 8;
void setup() {
pinMode(buzzerPin, OUTPUT);
Serial.begin(9600);
Serial.println("Active Buzzer Module demo starting");
}
void loop() {
Serial.println("Buzzer ON");
digitalWrite(buzzerPin, HIGH); // Active buzzer sounds when signal is HIGH
delay(500);
Serial.println("Buzzer OFF");
digitalWrite(buzzerPin, LOW);
delay(500);
}
Describe what you want to build. Codey Online writes the code, draws the wiring diagram, compiles it and flashes your board straight from the browser.
Start for free