Products

News

Contact Us

Phone

Current Position > Products

Product Name: KEYES Passive buzzer module with demo code

passive buzzer module
Buzzer is an integrated structure of electronic transducers, DC power supply, widely used in computers, printers, copiers, alarms, electronic toys, automotive electronic equipment, telephones, timers and other electronic products for sound devices . Active buzzer 5V Rated power can be directly connected to a continuous sound, this section dedicated sensor expansion module and the Arduino board in combination, can complete a simple circuit design, to "plug and play."

passive buzzer module

Buzzer is an integrated structure of electronic transducers, DC power supply, widely used in computers, printers, copiers, alarms, electronic toys, automotive electronic equipment, telephones, timers and other electronic products for sound devices . Active buzzer 5V Rated power can be directly connected to a continuous sound, this section dedicated sensor expansion module and the Arduino board in combination, can complete a simple circuit design, to "plug and play."

int buzzer = 11 ;/ / setting controls the digital IO foot buzzer
void setup ()
{
 pinMode (buzzer, OUTPUT) ;/ / set the digital IO pin mode, OUTPUT to output
}
void loop ()
{
 unsigned char i, j ;/ / define variables
 while (1)
 {
for (i = 0; i <80; i + +) / / outputs a frequency sound
 {
  digitalWrite (buzzer, HIGH) ;/ / send voice
    delay (1) ;/ / Delay 1ms
  digitalWrite (buzzer, LOW) ;/ / do not send voice
 delay (1) ;/ / delay ms
  }
   for (i = 0; i <500; i + +) / / output to another frequency sound
    {
      digitalWrite (buzzer, HIGH) ;/ / send voice
      delay (2) ;/ / delay 2ms
      digitalWrite (buzzer, LOW) ;/ / do not send voice
      delay (2) ;/ / delay 2ms
    }
  }
}