Codey Online › Libreria di componenti Arduino ed ESP32 › Buzzer module passief Arduino
Buzzer module passief  Arduino
Output

Buzzer module passief Arduino

Modulo buzzer passivo Arduino Questo buzzer passivo emette un suono di circa 85 dB quando viene collegato a una tensione compresa tra 4 V e 8 V. Questo buzzer passivo richiede un microcontrollore per generare il suono tramite un segnale PWM. Il buzzer consuma circa 30 mA. Tensione: 5 V. Adatto, tra gli altri, per Arduino.

Larghezza: 25 mm

Pinout — Buzzer module passief Arduino

Pin Segnale Descrizione
PWM PWM PWM control input from the microcontroller to generate the buzzer tone.
VCC power Positive supply for the passive buzzer module, typically 5V.
GND ground Ground return for the buzzer module and control signal.

Schema di cablaggio di esempio — Buzzer module passief Arduino

Da A Filo
board:D9 x1:PWM green
board:5V x1:VCC red
board:GND x1:GND black

Codice Arduino di esempio — Buzzer module passief Arduino

Questo esempio è stato scritto e verificato in compilazione per arduino-uno. Codey Online lo adatta a qualsiasi altra scheda supportata.

// Passive buzzer module example for Arduino Uno
// Plays a simple melody using the module's PWM input.

const int buzzerPin = 9; // Connected to x1:PWM

void setup() {
  pinMode(buzzerPin, OUTPUT);
  Serial.begin(9600);
  Serial.println("Passive buzzer module demo starting...");
}

void playTone(int frequency, int durationMs) {
  if (frequency > 0) {
    tone(buzzerPin, frequency, durationMs);
  }
  delay(durationMs * 1.30);
  noTone(buzzerPin);
}

void loop() {
  Serial.println("Playing C major scale...");

  int melody[] = {262, 294, 330, 349, 392, 440, 494, 523};
  int noteDuration = 180;

  for (int i = 0; i < 8; i++) {
    Serial.print("Note frequency: ");
    Serial.println(melody[i]);
    playTone(melody[i], noteDuration);
  }

  Serial.println("Pausing...");
  delay(1000);
}

Componenti correlati

Passive Buzzer Module

Passive Buzzer Module

Active Buzzer Module

Active Buzzer Module

3-Channel 5V Relay Module

3-Channel 5V Relay Module

DC 12V adjustable timer delay, time delay relay turn off switch module time relay time switch 0~25sec for smart home, automatic control

DC 12V adjustable timer delay, time delay relay turn off switch module time relay time switch 0~25sec for smart home, automatic control

Crea il tuo progetto Arduino o ESP32 con l'AI

Descrivi cosa vuoi realizzare. Codey Online scrive il codice, disegna lo schema di collegamento, lo compila e programma la tua scheda direttamente dal browser.

Inizia gratis