My Tone!

So you guys should totally listen to my Arduino stuff!
I like it.

Screen Shot 2013-11-13 at 7.32.41 PM

#include “pitches.h”

int melody[] = {
NOTE_G3,NOTE_A3,NOTE_B3,NOTE_E4,NOTE_D4,NOTE_B3,NOTE_A3,NOTE_G3,NOTE_G3};

int noteDurations[] = {
4,4,4,4,2,4,4,8,8};

void setup() {
for (int thisNote = 0; thisNote < 8; thisNote++){
int noteDuration = 1000/noteDurations[thisNote];
tone(11, melody[thisNote], noteDuration);

int pauseBetweenNotes = noteDuration * 1.30;
delay(pauseBetweenNotes);
noTone(11);
}
}
void loop() {
}

Leave a Reply