Codey OnlineArduino- & ESP32-componentenbibliotheek › Passive Buzzer Module
Passive Buzzer Module
Output

Passive Buzzer Module

Een passieve buzzer-module maakt geluid door een digitale blokgolf (vaak via PWM) op de S-besturingspin om te zetten in hoorbare tonen. Sluit VCC aan op de voeding en GND op massa, en varieer daarna de PWM of het schakelen op S om de toonhoogte of patronen te veranderen.

Breedte: 27.7 mm

Pinout — Passive Buzzer Module

Pin Signaal Beschrijving
S PWM Buzzer drive input — apply a PWM/square wave tone signal from the controller
VCC power Positive supply for the buzzer module, typically connected to 5V
GND ground Ground reference for the buzzer module and control signal

Voorbeeld-aansluitschema — Passive Buzzer Module

Van Naar Draad
board:D9 x1:S green
board:5V x1:VCC red
board:GND x1:GND black

Voorbeeld-Arduinocode — Passive Buzzer Module

Dit voorbeeld is geschreven en compile-gecheckt voor de arduino-uno. Codey Online past het voor je aan naar elk ander ondersteund board.

// Passive Buzzer Module example for Arduino Uno
// Plays a short melody using a PWM/square wave output on D9.

const int BUZZER_PIN = 9;

// Note frequencies in Hz
const int NOTE_C4 = 262;
const int NOTE_D4 = 294;
const int NOTE_E4 = 330;
const int NOTE_G4 = 392;
const int NOTE_C5 = 523;

void playTone(int frequency, int duration) {
  tone(BUZZER_PIN, frequency);
  delay(duration);
  noTone(BUZZER_PIN);
  delay(50);
}

void setup() {
  pinMode(BUZZER_PIN, OUTPUT);
  Serial.begin(9600);
  Serial.println("Passive Buzzer Module demo starting...");
}

void loop() {
  Serial.println("Playing melody...");

  playTone(NOTE_C4, 300);
  playTone(NOTE_D4, 300);
  playTone(NOTE_E4, 300);
  playTone(NOTE_G4, 300);
  playTone(NOTE_C5, 600);

  delay(1000);
}

Vergelijkbare componenten

3W amplifier MAX98357A I2S DAC

3W amplifier MAX98357A I2S DAC

Active Buzzer Module

Active Buzzer Module

⚙️

LED

LED Matrix Module MAX7219

LED Matrix Module MAX7219

Bouw je Arduino- of ESP32-project met AI

Beschrijf wat je wilt bouwen. Codey Online schrijft de code, tekent het aansluitschema, compileert het en flasht je board rechtstreeks vanuit de browser.

Gratis starten