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.
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
-
Single Touch ON OFF Switch Using 555 And 4017
-
Multi-Pattern LED Chaser
-
Arduino Remote control AC Dimmer
-
Distance Measure Using Ultrasonic Sensor
-
Delay ON Timer circuit using transistor
-
What is NOT gate (Inverter)