Quantcast
Channel: Melody generator/ Door bell alarm – circuitspedia.com
Viewing all articles
Browse latest Browse all 4

Bird Sound Generator Circuit Using Arduino

$
0
0

Bird Sound Generator Circuit using Arduino

This is the schematic diagram of the birds sound generator. Connect 1 NPN transistor BC547, emitter pin of this transistor is conned with the 5V supply and a 10K resistor is connected with Ground to pin no 2 of Arduino. Connect A push button switch between the pin no 2 and 5v VCC supply. A speaker is connected with the collector of BC547 and Ground. 

bird tone sound generator using arduino

Arduino Program for Birds Sound Generator

int buzzer = 12;
int butt = 3;
int count = 10;
int count2 = 5;
int i;
void setup() {
  // put your setup code here, to run once:
pinMode(butt,INPUT);
pinMode(buzzer,OUTPUT);
}
void loop() {

if(digitalRead(butt)==HIGH){

    while(count2 >0){
 for( i = 300; i>0; i--){
   digitalWrite(buzzer,HIGH);
  delayMicroseconds(i);
  digitalWrite(buzzer,LOW);
  delayMicroseconds(i);
  } 
delay(100);
    count2 = count2 -1;
      } 
      count2 = 5;
      
    while(count >0){
   
  for( i = 0; i <300; i++){
  digitalWrite(buzzer,HIGH);
  delayMicroseconds(i);
  digitalWrite(buzzer,LOW);
  delayMicroseconds(i);
  } 
  
   count = count -1;
  }
count = 10;
 for( int i2 = 300; i2>0; i2--){
  digitalWrite(buzzer,HIGH);
  delayMicroseconds(i2);
  digitalWrite(buzzer,LOW);
  delayMicroseconds(i2);
  } 

delay(400);

   while(count2 >0){
 for( i = 300; i>0; i--){
   digitalWrite(buzzer,HIGH);
  delayMicroseconds(i);
  digitalWrite(buzzer,LOW);
  delayMicroseconds(i);
  } 
delay(400);
    count2 = count2 -1;
      } 
      count2 = 5;
      
    while(count >0){
   
  for( i = 0; i <300; i++){
  digitalWrite(buzzer,HIGH);
  delayMicroseconds(i);
  digitalWrite(buzzer,LOW);
  delayMicroseconds(i);
  }
  delay(100); 
   count = count -1;
  }
count = 10;
 for( int i2 = 300; i2>0; i2--){
  digitalWrite(buzzer,HIGH);
  delayMicroseconds(i2);
  digitalWrite(buzzer,LOW);
  delayMicroseconds(i2);

}
}
}

 Video

Also Read


Viewing all articles
Browse latest Browse all 4

Trending Articles