My code - once it gets to the b3 it stops dead.
Can anyone see if anything is wrong?
int speaker=6;
int a=440;
int b=493.883;
int b3=246.94;
int c=523.251;
int e=329.628;
int mc=261.626;
int d= 293.665;
int f=349.228;
int eflat=311.127;
int bflat=466.164;
int g=391.995;
int e5=659.25;
int d5=587.33;
int nosound=0;
//To The Left
int hollyjolly []={e,g,c,c,b,b,a,e,e,g,a,a,g,g,b3,b,b,b,a,g,g,g,e,g,g,f,g,e,e,g,c,c,b,b,a,f,e,g,a,a,g,g,b3,b,b,b,a,g,g,g,e,g,g,f,e,mc};
//how long each note is 4=quater note, 3=quater with dot, 8=eighth note, 2=half note 2.5=half with dot
int durationleft[]={8,8,4,4,4,4,4,2,8,8,4,4,4,4,1,4,4,3,8,4,4,3,8,4,4,4,4,2.5,8,8,4,4,4,4,4,2,8,8,4,4,4,4,1,4,4,3,8,4,4,3,8,4,4,4,4,1};
void setup()
{
pinMode(speaker,OUTPUT);
}
void loop()
{
for(int thisNote=0; thisNote<100; thisNote++){
int noteDuration=5000/durationleft[thisNote];
tone(speaker,hollyjolly[thisNote],noteDuration);
delay(noteDuration*0.30);
noTone(6);
}
}
Moderator edit:
</mark> <mark>[code]</mark> <mark>
</mark> <mark>[/code]</mark> <mark>
tags added.