Home Arduino KY-012 Active Buzzer Module

KY-012 Active Buzzer Module

by iainhendry

 

The KY-012 Active Buzzer Module. The module consists of an active piezoelectric buzzer, it generates a sound of aproximately 2.5kHz when signal is high.

Connection

Connect signal (S) to pin 8 on the Arduino and Ground (-) to GND.

KY-012 Arduino
S Pin 8
GND

 

Code

[codesyntax lang=”cpp”]

//Example code KY012 active buzzer
int speakerPin = 8;
void setup () {
  pinMode (speakerPin, OUTPUT);
}
void loop () {
  analogWrite (speakerPin, 255);
  delay (50);
  analogWrite (speakerPin, 0);
  delay (10);
}

[/codesyntax]

 

Links

37 in 1 box Sensor Kit For Arduino Starters brand in stock

You may also like

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More