Home
About Us
Call us
Contact Us
CREATIVE ELECTRONICS
Home-icon
Recent
Arduino Projects
Home Automatiom
Carona Projects
Volt E-Byk
Random
Home
arduino projects
NATIONAL ANTHAM SONG USING MAKER UNO
NATIONAL ANTHAM SONG USING MAKER UNO
CREATIVE ELECTRONICS
January 26, 2022
hello guys today we are going to make an NATIONAL ANTHAM TUNE USING THE MAKER UNO
int speakerPin =8; //buzzer is connected to Pin 8 of the Board. int length = 149; // the number of notes char notes[] = "cdeeeeeeeeedef eeedddbdc ccgggggggggaf fffffeddf eedeedeggaff eeeeeddbdc cdeeeedf efgggfedfe feeeddbdc ccggggeggggga fffffedfe egc bab aga ccddeedef "; // a space represents a rest //char notes[] = "ccddeeeeeeedef eeedddb-dc cggggggggf#ag fffeeedfe eeeeedgggff eeedddb-dc cdeeeedef efgggfedfe eedddb-dc ggggggggggf#ag fffeeedfe egc+ bab aga ccddeedef "; // a space represents a rest int beats[] = { 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 2, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 1 }; int tempo = 200; //set tempo void playTone(int tone, int duration) { //created a square wave for given time duration for (long i = 0; i < duration * 1000L; i += tone * 2) { digitalWrite(speakerPin, HIGH); delayMicroseconds(tone); digitalWrite(speakerPin, LOW); delayMicroseconds(tone); } } void playNote(char note, int duration) { //Assigning high time for the notes char names[] = { 'c', 'd', 'e', 'f', 'g', 'a', 'b', 'C' }; int tones[] = { 956, 851, 758, 716, 638, 568, 1014, 478 }; // play the tone corresponding to the note name for (int i = 0; i < 8; i++) { if (names[i] == note) { playTone(tones[i], duration); } } } void setup() { pinMode(speakerPin, OUTPUT); // pin 7 as an OutPut Pin } void loop() { //Main function for (int i = 0; i < length; i++) { //For the length of the tune array if (notes[i] == ' ') { //take space as rest delay(beats[i] * tempo); // rest } else { playNote(notes[i], beats[i] * tempo); //play the corresponding note for the corresponding beat } // pause between notes delay(tempo / 2); } }
Click to Copy
Post a Comment
0 Comments
CREATIVE ELECTRONICS
Search This Blog
Link List
HOME AUTOMATION
UNBOX & REVIEW
CARONA PROJECTS
ARDUINO PROJECTS
VOLT E-BYK
Follow us
youtube
facebook
twitter
linkedin
Popular Posts
how to Light control using ultrasonic sensor and relay module
August 27, 2021
how to make PULSE OXIMETER using ARDUINO
September 07, 2021
How to make distance indicator with arduino
August 27, 2021
Contact Form
Name
Email
*
Message
*
0 Comments