Bird
0
0
Arduinoprogramming~10 mins

Why sound output is useful in Arduino - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to play a sound using the buzzer.

Arduino
tone(8, [1]);
Drag options to blanks, or click blank then click option'
ApinMode
BdigitalWrite
Cdelay
D440
Attempts:
3 left
💡 Hint
Common Mistakes
Using a function name instead of a frequency number.
2fill in blank
medium

Complete the code to stop the sound from the buzzer.

Arduino
noTone([1]);
Drag options to blanks, or click blank then click option'
A9
B7
C8
D10
Attempts:
3 left
💡 Hint
Common Mistakes
Using a pin number different from the buzzer's pin.
3fill in blank
hard

Fix the error in the code to play a 1-second beep.

Arduino
tone(8, 1000);
delay([1]);
noTone(8);
Drag options to blanks, or click blank then click option'
A100
B1000
C10
D5000
Attempts:
3 left
💡 Hint
Common Mistakes
Using delay less than 1000 causes a shorter beep.
4fill in blank
hard

Fill both blanks to create a dictionary of notes and their frequencies.

Arduino
int notes[] = [1];
int frequencies[] = [2];
Drag options to blanks, or click blank then click option'
A{262, 294, 330, 349}
B[262, 294, 330, 349]
C{440, 494, 523, 587}
D[440, 494, 523, 587]
Attempts:
3 left
💡 Hint
Common Mistakes
Using square brackets which are not valid for array initialization in Arduino C++.
5fill in blank
hard

Fill all three blanks to play each note for 500 milliseconds.

Arduino
for (int i = 0; i < [1]; i++) {
  tone(8, [2][i]);
  delay([3]);
  noTone(8);
}
Drag options to blanks, or click blank then click option'
A4
Bfrequencies
C500
Dnotes
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong array name or wrong loop count.