Things used in this project

Hardware components:
Ard nano
Arduino Nano R3
×1
Software apps and online services:
Ide web
Arduino IDE

Code

Happy_birthdayArduino
Don't forget to install Tone library!!
#include <Tone.h>

Tone solo;
Tone bass;
Tone rythm;

const int t = 600;  // quater note duration
const int tt = t*2;
const int t14 = round(t*1/4);
const int t24 = round(t*2/4);
const int t34 = round(t*3/4);

const int bassLedPin = 15;  // bass led signal pin (aka A1)
const int rythmLedPin = 17;  // rythm led signal pin (aka A3)
const int soloLedPin = 19;  // solo led signal pin (aka A5)

void wait(Tone t)
{
  while (t.isPlaying()) { }  
}

int bassLedState = LOW;
void switchBassLed()
{
  if (bassLedState == LOW)
    bassLedState = HIGH;
  else
    bassLedState = LOW;
  digitalWrite(bassLedPin, bassLedState);
}

int rythmLedState = LOW;
void switchRythmLed()
{
  if (rythmLedState == LOW)
    rythmLedState = HIGH;
  else
    rythmLedState = LOW;
  digitalWrite(rythmLedPin, rythmLedState);
}

int soloLedState = LOW;
void switchSoloLed()
{
  if (soloLedState == LOW)
    soloLedState = HIGH;
  else
    soloLedState = LOW;
  digitalWrite(soloLedPin, soloLedState);
}



void setup(void)
{
  pinMode(14, OUTPUT); // led ground pin (aka A0)
  pinMode(16, OUTPUT); // led ground pin (aka A2)
  pinMode(18, OUTPUT); // led ground pin (aka A4)
  pinMode(bassLedPin, OUTPUT);  // bass led signal pin
  pinMode(rythmLedPin, OUTPUT);  // rythm led signal pin
  pinMode(soloLedPin, OUTPUT);  // solo led signal pin

  pinMode(2, OUTPUT);  // solo buzzer ground pin
  pinMode(9, OUTPUT);  // rythm buzzer ground pin 

  solo.begin(6);  // solo buzzer signal pin
  bass.begin(12);  // bass buzzer signal pin
  rythm.begin(0);  // rythm buzzer signal pin

        solo.play(NOTE_D4, t34); switchSoloLed();
        wait(solo);
        solo.play(NOTE_D4, t14); switchSoloLed();
        wait(solo);
}



void loop(void)
{

bass.play(NOTE_G3, t); switchBassLed();
  rythm.play(NOTE_G4, t24); switchRythmLed();
        solo.play(NOTE_E4, t); switchSoloLed();
        wait(rythm);
  rythm.play(NOTE_B4, t14); switchRythmLed();
        wait(rythm);
  rythm.play(NOTE_D5, t14); switchRythmLed();
        wait(rythm);
bass.play(NOTE_B3, t); switchBassLed();
  rythm.play(NOTE_G4, t24); switchRythmLed();
        solo.play(NOTE_D4, t); switchSoloLed();
        wait(rythm);
  rythm.play(NOTE_B4, t14); switchRythmLed();
        wait(rythm);
  rythm.play(NOTE_D5, t14); switchRythmLed();
        wait(rythm);
bass.play(NOTE_D4, t); switchBassLed();
  rythm.play(NOTE_G4, t24); switchRythmLed();
        solo.play(NOTE_G4, t); switchSoloLed();
        wait(rythm); 
  rythm.play(NOTE_B4, t14); switchRythmLed();
        wait(rythm);
  rythm.play(NOTE_D5, t14); switchRythmLed();
        wait(rythm);

bass.play(NOTE_D4, t); switchBassLed();
  rythm.play(NOTE_D5, t24); switchRythmLed();
        solo.play(NOTE_FS4, tt); switchSoloLed();
        wait(rythm);
  rythm.play(NOTE_FS5, t14); switchRythmLed();
        wait(rythm);
  rythm.play(NOTE_A5, t14); switchRythmLed();
        wait(rythm);
bass.play(NOTE_FS4, t); switchBassLed();
  rythm.play(NOTE_D5, t24); switchRythmLed();
        wait(rythm);
  rythm.play(NOTE_FS5, t14); switchRythmLed();
        wait(rythm);
  rythm.play(NOTE_A5, t14); switchRythmLed();
        wait(rythm);
bass.play(NOTE_A4, t); switchBassLed();
  rythm.play(NOTE_D5, t24); switchRythmLed();
        solo.play(NOTE_D4, t34); switchSoloLed();
        wait(rythm);        
  rythm.play(NOTE_FS5, t14); switchRythmLed();
        wait(rythm);
  rythm.play(NOTE_A5, t14); switchRythmLed();    
        solo.play(NOTE_D4, t14); switchSoloLed();
        wait(rythm);

bass.play(NOTE_D4, t); switchBassLed();
  rythm.play(NOTE_D5, t24); switchRythmLed();
        solo.play(NOTE_E4, t); switchSoloLed();
        wait(rythm);
  rythm.play(NOTE_FS5, t14); switchRythmLed();
        wait(rythm);
  rythm.play(NOTE_A5, t14); switchRythmLed();
        wait(rythm);        
bass.play(NOTE_FS4, t); switchBassLed();
  rythm.play(NOTE_D5, t24); switchRythmLed();
        solo.play(NOTE_D4, t); switchSoloLed();
        wait(rythm);
  rythm.play(NOTE_FS5, t14); switchRythmLed();
        wait(rythm);
  rythm.play(NOTE_A5, t14); switchRythmLed();
        wait(rythm);         
bass.play(NOTE_A4, t); switchBassLed();
  rythm.play(NOTE_D5, t24); switchRythmLed();
        solo.play(NOTE_A4, t); switchSoloLed();
        wait(rythm);
  rythm.play(NOTE_FS5, t14); switchRythmLed();
        wait(rythm);
  rythm.play(NOTE_A5, t14); switchRythmLed();
        wait(rythm);  


bass.play(NOTE_G3, t); switchBassLed();
  rythm.play(NOTE_G4, t24); switchRythmLed();
        solo.play(NOTE_G4, tt); switchSoloLed();
        wait(rythm);        
  rythm.play(NOTE_B4, t14); switchRythmLed();
        wait(rythm);
  rythm.play(NOTE_D5, t14); switchRythmLed();
        wait(rythm);
bass.play(NOTE_B3, t); switchBassLed();
  rythm.play(NOTE_G4, t24); switchRythmLed();
        wait(rythm);
  rythm.play(NOTE_B4, t14); switchRythmLed();
        wait(rythm);
  rythm.play(NOTE_D5, t14); switchRythmLed();
        wait(rythm);        
bass.play(NOTE_D4, t); switchBassLed();
  rythm.play(NOTE_G4, t24); switchRythmLed();
        solo.play(NOTE_D4, t34); switchSoloLed();
        wait(rythm);
  rythm.play(NOTE_B4, t14); switchRythmLed();
        wait(rythm);
  rythm.play(NOTE_D5, t14); switchRythmLed();       
        solo.play(NOTE_D4, t14); switchSoloLed();
        wait(rythm);

bass.play(NOTE_G3, t); switchBassLed();
  rythm.play(NOTE_G4, t24); switchRythmLed();
        solo.play(NOTE_D5, t); switchSoloLed();
        wait(rythm);
  rythm.play(NOTE_B4, t14); switchRythmLed();
        wait(rythm);
  rythm.play(NOTE_D5, t14); switchRythmLed();
        wait(rythm);        
bass.play(NOTE_B3, t); switchBassLed();
  rythm.play(NOTE_G4, t24); switchRythmLed();
        solo.play(NOTE_B4, t); switchSoloLed();
        wait(rythm);
  rythm.play(NOTE_B4, t14); switchRythmLed();
        wait(rythm);
  rythm.play(NOTE_D5, t14); switchRythmLed();
        wait(rythm);          
bass.play(NOTE_D4, t); switchBassLed();
  rythm.play(NOTE_G4, t24); switchRythmLed();
        solo.play(NOTE_G4, t); switchSoloLed();
        wait(rythm);
  rythm.play(NOTE_B4, t14); switchRythmLed();
        wait(rythm);
  rythm.play(NOTE_D5, t14); switchRythmLed();
        wait(rythm);       

bass.play(NOTE_C4, t); switchBassLed();
  rythm.play(NOTE_C5, t24); switchRythmLed();
        solo.play(NOTE_FS4, t); switchSoloLed();
        wait(rythm);
  rythm.play(NOTE_E5, t14); switchRythmLed();  
        wait(rythm);
  rythm.play(NOTE_G5, t14); switchRythmLed();   
        wait(rythm);       
bass.play(NOTE_E4, t);  switchBassLed();
  rythm.play(NOTE_C5, t24); switchRythmLed();
        solo.play(NOTE_E4, t); switchSoloLed();
        wait(rythm);
  rythm.play(NOTE_E5, t14); switchRythmLed();   
        wait(rythm);
  rythm.play(NOTE_G5, t14); switchRythmLed();   
        wait(rythm);          
bass.play(NOTE_G4, t); switchBassLed();
  rythm.play(NOTE_C5, t24); switchRythmLed();
        solo.play(NOTE_C5, t34); switchSoloLed();
        wait(rythm);
  rythm.play(NOTE_E5, t14); switchRythmLed();
        wait(rythm); 
  rythm.play(NOTE_G5, t14); switchRythmLed();     
        solo.play(NOTE_C5, t14); switchSoloLed();
        wait(rythm);

bass.play(NOTE_G3, t); switchBassLed();
  rythm.play(NOTE_G4, t24); switchRythmLed();
        solo.play(NOTE_B4, t); switchSoloLed();
        wait(rythm);
  rythm.play(NOTE_B4, t14); switchRythmLed();
        wait(rythm);
  rythm.play(NOTE_D5, t14); switchRythmLed();
        wait(rythm);         
bass.play(NOTE_D3, t); switchBassLed();
  rythm.play(NOTE_G4, t24); switchRythmLed();
        solo.play(NOTE_G4, t); switchSoloLed();
        wait(rythm);
  rythm.play(NOTE_B4, t14); switchRythmLed();
        wait(rythm);
  rythm.play(NOTE_D5, t14); switchRythmLed();
        wait(rythm); 
bass.play(NOTE_FS3, t); switchBassLed();
  rythm.play(NOTE_D5, t24); switchRythmLed();
        solo.play(NOTE_A4, t); switchSoloLed();
        wait(rythm);
        wait(rythm);
  rythm.play(NOTE_FS5, t14); switchRythmLed();
        wait(rythm);
  rythm.play(NOTE_A5, t14); switchRythmLed();
        wait(rythm);          

bass.play(NOTE_G3, t); switchBassLed();
  rythm.play(NOTE_G4, t24); switchRythmLed();
        solo.play(NOTE_G4, tt); switchSoloLed();
        wait(rythm);        
  rythm.play(NOTE_B4, t14); switchRythmLed();
        wait(rythm);
  rythm.play(NOTE_D5, t14); switchRythmLed();
        wait(rythm);
bass.play(NOTE_B3, t); switchBassLed();
  rythm.play(NOTE_G4, t24); switchRythmLed(); 
        wait(rythm);
  rythm.play(NOTE_B4, t14); switchRythmLed();
        wait(rythm);
  rythm.play(NOTE_D5, t14); switchRythmLed();
        wait(rythm);      
        solo.play(NOTE_D4, t34); switchSoloLed();
        wait(solo);
        solo.play(NOTE_D4, t14); switchSoloLed();
        wait(solo);

}

Credits

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

Voltmeter using Arduino
Easy
  • 85
  • 8

Protip

If you can't find voltmeter at home or at any other place, then this Hack is for you, Go ahead.

Voltmeter using Arduino

Team Next Tech Lab

USBphpTunnel
Easy
  • 150
  • 4

Protip

USBphpTunnel - Android app for MXQ TV box to control an Arduino board via USB from PHP.

DIY RC Car
Easy
  • 6
  • 1

Full instructions

Web-based Car Control with PHPoC Shield for Arduino

Arduino morse code machine
Easy
  • 475
  • 9

Full instructions

A simple arduino Morse code machine with a button,led and a buzzer that takes your input and translates it into English while you are typing

Arduino 101 - Intel Curie Pattern Matching Dress
Easy
  • 1,629
  • 14

Full instructions

A dress with Curie's pattern matching engine on Arduino101 to control the embedded LEDs, which makes constellations show up on the dress.

Arduino Laser Tripwire
Easy
  • 2,118
  • 15

Full instructions

An Arduino Uno project that utilizes a laser to detect when the laser beam has been interrupted.

ProjectsCommunitiesContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login
Respect project
Feedback