Complete the code to play a tone on pin 8 at 440 Hz.
tone(8, [1]);
The tone() function plays a sound at the specified frequency in hertz. 440 Hz is the standard A note.
Complete the code to stop the tone playing on pin 8.
noTone([1]);The noTone() function stops the tone on the specified pin. You must give the pin number.
Fix the error in the code to play a 500 Hz tone for 1000 milliseconds on pin 9.
tone(9, [1], 1000);
The second argument is the frequency in hertz. 500 is the correct frequency to play.
Fill both blanks to create a dictionary of notes with their frequencies and play the note 'C' on pin 7.
int notes[] = [1]; tone(7, notes[[2]]);
The array contains frequencies for notes C, D, E. Index 0 is for C, so playing notes[0] plays C.
Fill all three blanks to create a loop that plays notes from an array on pin 6 with 500 ms delay between notes.
int melody[] = [1]; for (int i = 0; i < [2]; i++) { tone(6, melody[[3]]); delay(500); }
The array has 4 notes. The loop runs 4 times. Using i as index plays each note in order.
