Lesson 4 – Sound with the Finch

Required Python Concepts


Teaching Materials

Get Access

The last Finch output is the buzzer. You can use two methods to play a tone on the Finch’s internal buzzer: buzzer() and buzzer_with_delay(). Both of these methods require two parameters. The first is the duration of the sound in seconds.The second parameter is the frequency of the sound; keep in mind that humans can only hear sounds in the range of 20 to 20,000 Hz.

The buzzer() method will start the buzzer and then immediately move on to the next line of code. The buzzer_with_delay() method, on the other hand, will pause the program until the sound is done before moving to the next line of the program.

Exercise 1:

Try out the code shown below. The robot should buzz while moving forward for two seconds.

Exercise 2:

What is the difference between the two code snippets shown below? Make a prediction and then test it. Be sure that you can explain why these pieces of code cause the Finch to behave differently.

Exercise 3:

Write a program to make the Finch move forward, then back. When the Finch is moving forward, it should make a low-pitched buzz. When the Finch is moving back, it should make a high-pitched buzz.

Exercise 4:

Write a program to make the Finch play a short song. Choose a song from this website and make the Finch play your song using its buzzer!

Exercise 5:

Practice all of the things you have learned about the Finch! Write a program to make the Finch move in a triangle, pentagon, or other shape. The Finch should buzz as it starts each side of the shape. For an added challenge, make the beak change to a different random color for each side of the shape.

Exercise 6:

Make the Finch dance! Write a script to make the Finch move and change its beak color. Use the buzzer to add sound!