Happy Birthday Song Using Arduino Uno: Step 1: Material Required
Happy Birthday Song Using Arduino Uno: Step 1: Material Required
by Technoesolution2020
Follow Me On :-
To make this project we need some components (Best Buy Link Provided):-
1. Arduino Uno X 1
2. Buzzzer X 1
[ Above link are a liated if you buy from above link, We got some bonus from it. ]
Follow the circuit diagram to make the connection. double-check your engineering les.
NextPCB is a high-quality PCB Manufacturer. With If you want a Printed circuit board go through the NEXT
professional PCB manufacturing capabilities, our PCB PCB
engineers with more than 10 years of experience will
/*
Hello Friends Welcome to Techno-E-Solution
Here is the Code For Happy Birthday Song
*/
int speakerPin = 8;
int length = 28; // the number of notes
char notes[] = "GGAGcB GGAGdc GGxecBA yyecdc";
int beats[] = { 2, 2, 8, 8, 8, 16, 1, 2, 2, 8, 8,8, 16, 1, 2,2,8,8,8,8,16, 1,2,2,8,8,8,16 };
int tempo = 150;
void playTone(int tone, int 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) {
char names[] = {'C', 'D', 'E', 'F', 'G', 'A', 'B',
'x', 'y' };
655 , 715 };
int SPEE = 5;
// play the tone corresponding to the note name
for (int i = 0; i < 17; i++) {
if (names[i] == note) {
int newduration = duration/SPEE;
playTone(tones[i], newduration);
}
}
}
void setup() {
pinMode(speakerPin, OUTPUT);
}
void loop() {
for (int i = 0; i < length; i++) {
if (notes[i] == ' ') {
delay(beats[i] * tempo); // rest
} else {
playNote(notes[i], beats[i] * tempo);
}
// pause between notes
delay(tempo);
}
}
If you like this project subscribe us on youtube for more interesting projects :-
https://www.youtube.com/embed/D8FZCPmeKzs
NEXTPCB PCB MANUFACTURER COMPANY the speed of PCB and assembly manufacturing with
e cient collaboration and quality assurance.
NextPCB was founded in 2004 and has since established
itself as a turnkey PCB manufacturing and assembly NextPCB provides a variety of PCBs with optimistic
factory for prototype quantities as well as small-volume capabilities. Starting from the single-layer they provide
to big-volume production. PCB services up to 20 layers, with a board thickness of
0.6mm to 2.5mm with a tolerance of 10% and much
Why NEXTPCB? more capabilities. Check out the manufacturing
capabilities of NextPCB for better production of your
NextPCB provides one-stop services for PCB with PCB.
professional PCB manufacturing practices ful lling the
advanced design requirements. The company provides