pythonpushover503
Published © GPL3+

Happy Birthday Song On Piezo Buzzer

Play the Happy Birthday Song on a piezo buzzer!!!

IntermediateFull instructions provided4,992
Happy Birthday Song On Piezo Buzzer

Things used in this project

Hardware components

Buzzer, Piezo
Buzzer, Piezo
×1
Arduino Mega 2560
Arduino Mega 2560
×1
Switch Actuator, APEM A01 series Illuminated Push-Button Switches
Switch Actuator, APEM A01 series Illuminated Push-Button Switches
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Story

Read more

Code

Birthday Code

Arduino
/*

*/
 int buzz = 5;
 int butt = 3;
  
void setup() {
  pinMode(buzz, OUTPUT);
  pinMode(butt, INPUT_PULLUP);
  
  
 
}
void loop() {
  
 if (digitalRead(butt) == LOW) {
   delay(100);
    tone(buzz, 131);
    delay(250);
    noTone(buzz);
    delay(125);
    tone(buzz, 131);
    delay(250);
    tone(buzz, 147);
    delay(500);
    tone(buzz, 131);
    delay(500);
    tone(buzz, 175);
    delay(500);
    tone(buzz, 165);
    delay(1000);
    tone(buzz, 131);
    delay(250);
    noTone(buzz);
    delay(125);
    tone(buzz, 131);
    delay(250);
    tone(buzz, 147);
    delay(500);
    tone(buzz, 131);
    delay(500);
    tone(buzz, 196);
    delay(500);
    tone(buzz, 175);
    delay(1000);
    tone(buzz, 131);
    delay(250);
    noTone(buzz);
    delay(125);
    tone(buzz, 131);
    delay(250);
    tone(buzz, 262);
    delay(500);
    tone(buzz, 220);
    delay(500);
    tone(buzz, 175);
    delay(500);
    tone(buzz, 165);
    delay(500);
    tone(buzz, 147);
    delay(500);
    tone(buzz, 233);
    delay(250);
    noTone(buzz);
    delay(125);
    tone(buzz, 233);
    delay(250);
    tone(buzz, 220);
    delay(500);
    tone(buzz, 175);
    delay(500);
    tone(buzz, 196);
    delay(500);
    tone(buzz, 175);
    delay(1000);
    noTone(buzz);
    delay(100);
    
    
  }
  
  
}

Credits

pythonpushover503
4 projects β€’ 2 followers

Comments