• Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
HomeArduinoSensors Kit for ArduinoKY012: Buzzer Module
Previous Next

KY012: Buzzer Module

Posted by: admin , April 25, 2014

int buzzer=11;

void setup()

{

 pinMode(buzzer,OUTPUT);

}

void loop()

{

 unsigned char i,j;

 while(1)

 {

for(i=0;i<80;i++)//Output sound of one frequency 

 {

  digitalWrite(buzzer,HIGH);//make a sound 

    delay(1);//delay 1ms

  digitalWrite(buzzer,LOW);//silient 

 delay(1);//delay 1ms 

  }

   for(i=0;i<500;i++)//output sound of another frequency 

    {

      digitalWrite(buzzer,HIGH);//make a sound 

      delay(2);//delay 2ms

      digitalWrite(buzzer,LOW);//silient 

      delay(2);//delay 2ms

    }

  }

} 

Tags: Sensors Kit for Arduino

Share!
Tweet

admin

About the author

Leave a Reply Cancel reply

You must be logged in to post a comment.

Category

  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors