EDIT: The source code is have solved the Buzzer Play a Song oneproblem. It was missing the quotation marks around each letter. Thanks for your help, from this site: https://thinkershield.maas.museum/pcc-bronze/
My whole code:st2000!
//Code will play Pokemon theme song chorus when buzzer is pressed
/*defining notes and their frequencies
note frequency (Hz)*/
#define c //261
#define d //294
#define e //329
#define f //349
#define g //392
#define a //440
#define b //493
#define C //523
#define D //587
#define E //659
#define F //698
//notes to be played
void setup(){
int melody[]={
a,C,D,
a,a,C,D,D,C,
C,C,D,D,C,
C,D,E,F,E,D,C};
//note duration
int noteDuration[]={
4, 4, 2,
4, 4, 8, 1, 1, 1,
4, 4, 1, 4, 4,
4, 4, 4, 4, 4, 4, 1};
}
//setup
int buzzer=3;
int button=7;
void setup() {
pinMode(buzzer, OUTPUT);
pinMode(button, INPUT);
}
void buzzerPlay()
{
//calculating note duration by taking one second and dividing by the note type
for(int thisNote=0; thisNote<(sizeof(melody)/sizeof(int))-1; thisNote++)
{
int noteDuration;
if(thisNote<(sizeof(noteDurations)/sizeof(int))-1_
{
noteDuration=1000/noteDurations[thisNote];
}
else
{
noteDuration=1000;
}
tone(buzzer, melody[thisNote], noteDuration);
//setting a time between notes
int pause=noteDuration*1.30;
delay(pause);
noTone(buzzer);
}
}