Bruce Liu
Published © GPL3+

mCookie Birthday Song

Play simple songs with a single buzzer!

IntermediateShowcase (no instructions)476
mCookie Birthday Song

Things used in this project

Hardware components

Microduino CoreUSB
×1

Story

Read more

Schematics

Schematic

Picture.

Code

Birthday Song Code

C/C++
Upload into CoreUSB module.
int song[] ={
    262,262,294,262,349,330,
    262,262,294,262,392,349,
    262,262,523,440,349,330,294,
    494,494,440,349,392,349
};
 
int noteDurations[] = { 
  4,4,2,2,2,1,
  4,4,2,2,2,1,
  4,4,2,2,2,2,2,
  4,4,2,2,2,1
};
 
void setup() {
  for (int thisNote = 0; thisNote<25;thisNote++)
  {
    int noteDuration = 1000/noteDurations[thisNote];
    tone(8, song[thisNote],noteDuration);
    int pauseBetweenNotes = noteDuration *1.30;
    delay(pauseBetweenNotes);
    noTone(8);
  }
}
void loop() {
  setup();
}

Credits

Bruce Liu
1 project • 0 followers
Microduino Product Manager and DIY Enthusiast
Contact

Comments

Please log in or sign up to comment.