// notes kiit
// F#4 G4 F#4 C#5 F#5 G5 F#5 C#5 F#4 G4 F#4 C#5 F#5 E5 (pause)
// F#4 G4 F#4 C#5 F#5 G5 F#5 C#5 F#4 G4 F#4 C#5 F#5 G5 E5 F#5
// http://pages.mtu.edu/~suits/notefreqs.html
#define note_Ch5 555
#define note_E5 660
#define note_Fh4 370
#define note_Fh5 740
#define note_G4 392
#define note_G5 784
int delay_val=10;
int tone_pin = 4;
void setup() {
// initialize digital pin 13 as an output.
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(5, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(2, INPUT_PULLUP);
pinMode(3, INPUT_PULLUP);
attachInterrupt(0, dec_delay,FALLING);
attachInterrupt(1, inc_delay,FALLING);
}
// the loop function runs over and over again forever
void loop()
{
// F#4 G4 F#4 C#5 F#5 G5 F#5 C#5 F#4 G4 F#4 C#5 F#5 E5 (pause)
// F#4 G4 F#4 C#5 F#5 G5 F#5 C#5 F#4 G4 F#4 C#5 F#5 G5 E5 F#5
kr_blink(); tone(tone_pin, note_Fh4, 150);
kr_blink(); tone(tone_pin, note_G4, 150);
kr_blink(); tone(tone_pin, note_Fh4, 150);
kr_blink(); tone(tone_pin, note_Ch5, 150);
kr_blink(); tone(tone_pin, note_Fh5, 150);
kr_blink(); tone(tone_pin, note_G5, 150);
kr_blink(); tone(tone_pin, note_Fh5, 150);
kr_blink(); tone(tone_pin, note_Ch5, 150);
kr_blink(); tone(tone_pin, note_Fh4, 150);
kr_blink(); tone(tone_pin, note_G4, 150);
kr_blink(); tone(tone_pin, note_Fh4, 150);
kr_blink(); tone(tone_pin, note_Ch5, 150);
kr_blink(); tone(tone_pin, note_Fh5, 150);
kr_blink(); tone(tone_pin, note_E5, 150);
delay(300);
kr_blink(); tone(tone_pin, note_Fh4, 150);
kr_blink(); tone(tone_pin, note_G4, 150);
kr_blink(); tone(tone_pin, note_Fh4, 150);
kr_blink(); tone(tone_pin, note_Ch5, 150);
kr_blink(); tone(tone_pin, note_Fh5, 150);
kr_blink(); tone(tone_pin, note_G5, 150);
kr_blink(); tone(tone_pin, note_Fh5, 150);
kr_blink(); tone(tone_pin, note_Ch5, 150);
kr_blink(); tone(tone_pin, note_Fh4, 150);
kr_blink(); tone(tone_pin, note_G4, 150);
kr_blink(); tone(tone_pin, note_Fh4, 150);
kr_blink(); tone(tone_pin, note_G5, 150);
kr_blink(); tone(tone_pin, note_E5, 150);
kr_blink(); tone(tone_pin, note_Fh5, 150);
}
void inc_delay()
{
delay_val=delay_val+2;
}
void dec_delay()
{
if(delay_val>3)
delay_val=delay_val-2;
}
void kr_blink(void)
{
digitalWrite(6, HIGH);
delay(delay_val);
digitalWrite(6, LOW);
delay(delay_val);
digitalWrite(7, HIGH);
delay(delay_val);
digitalWrite(7, LOW);
delay(delay_val);
digitalWrite(8, HIGH);
delay(delay_val);
digitalWrite(8, LOW);
delay(delay_val);
digitalWrite(5, HIGH);
delay(delay_val);
digitalWrite(5, LOW);
delay(delay_val);
digitalWrite(9, HIGH);
delay(delay_val);
digitalWrite(9, LOW);
delay(delay_val);
digitalWrite(10, HIGH);
delay(delay_val);
digitalWrite(10, LOW);
delay(delay_val);
digitalWrite(11, HIGH);
delay(delay_val);
digitalWrite(11, LOW);
delay(delay_val);
digitalWrite(12, HIGH);
delay(delay_val);
digitalWrite(12, LOW);
delay(delay_val);
digitalWrite(11, HIGH);
delay(delay_val);
digitalWrite(11, LOW);
delay(delay_val);
digitalWrite(10, HIGH);
delay(delay_val);
digitalWrite(10, LOW);
delay(delay_val);
digitalWrite(9, HIGH);
delay(delay_val);
digitalWrite(9, LOW);
delay(delay_val);
digitalWrite(5, HIGH);
delay(delay_val);
digitalWrite(5, LOW);
delay(delay_val);
digitalWrite(8, HIGH);
delay(delay_val);
digitalWrite(8, LOW);
delay(delay_val);
digitalWrite(7, HIGH);
delay(delay_val);
digitalWrite(7, LOW);
delay(delay_val);
}
Comments