Lesson 3 – Color with the Finch

Required Python Concepts

Using a random number generator

Teaching Materials

Get Access

You can use the Finch methods to change the color of the Finch’s beak! The Finch’s beak actually has three tiny light elements inside it. One is red, one is green, and one is blue. This is important for programming the beak. To change the color of the beak, use the led() method.

The led() method requires three parameters. The red parameter controls the amount of red light from 0 (none) to 255 (maximum brightness). The green and blue parameters control the amount of green and blue light, respectively, from 0 to 255. By combining different amounts of these three colors, you can also create other colors. For example, red light and blue light will combine to make purple.

Exercise 1:

Try the commands shown below. The Finch’s beak should turn red for two seconds.

Exercise 2:

Write a program to make the beak turn purple, then aqua, then yellow.

Exercise 3:

Write a program that asks the user for the amount of red, green, and blue in the beak color. The beak should stay that color for three seconds.

Exercise 4:

Write a program to make the Finch move forward, then back. When the Finch is moving forward, its beak should be green. When the Finch is moving back, its beak should be red.

Exercise 5:

Make the Finch into a spinner for a game like Twister or Chutes and Ladders. Create a program that spins the Finch for a random amount of time; you will need to use a random number generator for this. The Finch’s beak should be red while it is spinning and green when it stops.