/* I made this code for me and my brothers birthday, our favorite colors are blue and green, so thats why the colors i used in this code are colored the way they are, the list of tones is supposed to be the happy birthday song but im not sure, i havent tested it yet,
I only listened to each individual tone, it should work, enjoy this for your birthday or someone elses, comment on what the song sounds like so i can fix it. Made by Mike44449. */
int button = 9;
int greenLed = 8; //you can change the colors if you want
int blueLed = 7;
int buzzer = 4;
void setup()
{
pinMode(button,INPUT);
pinMode(greenLed,OUTPUT);
pinMode(blueLed,OUTPUT);
pinMode(buzzer,OUTPUT);
}
void loop()
{
if(digitalRead(button) == HIGH)
{
tone(buzzer,340,1500); //supposed to be the birthday song
tone(buzzer,400,2000);
tone(buzzer,440,1000);
tone(buzzer,390,1000);
tone(buzzer,340,1500);
tone(buzzer,400,2000);
tone(buzzer,450,1000);
tone(buzzer,400,1000);
tone(buzzer,340,1500);
tone(buzzer,470,2000);
tone(buzzer,320,1000);
tone(buzzer,300,1000);
tone(buzzer,380,1300);
tone(buzzer,340,1000);
tone(buzzer,300,1100);
digitalWrite(greenLed = HIGH); // makes the two LEDs flash at intervels
delay(900);
digitalWrite(greenLed = LOW);
digitalWrite(blueLed = HIGH);
delay(900);
digitalWrite(blueLed = LOW);
digitalWrite(greenLed = HIGH);
delay(900);
digitalWrite(greenLed = LOW);
digitalWrite(blueLed = HIGH);
delay(900);
digitalWrite(blueLed = LOW);
}
else{
digitalWrite(blueLed = LOW);
digitalWrite(greenLed = LOW);
}
}