Programming with Gestures
Create a way for young children to program the Finch!
In this project, you will create a way for young children to program the Finch. The Finch will have two modes. In the recording mode, a child can tilt the Finch in different directions. Your program will save this sequence of tilts in a list. In the play mode, the Finch will translate the sequence of tilts into a sequence of movements.
First, write a script that will control the Finch when it is in record mode. In this mode, the user will tilt the Finch in different directions (Beak Up, Beak Down, Left Wing Down, Right Wing Down, and Level). Your goal is to record this sequence of tilts in a list called listOfOrientations. The requirements for record mode are listed below.
- The record mode should start when the user presses the ‘r’ key.
- At the beginning of the record script, listOfOrientations should be set to an empty list.
- In record mode, the robot should record the Finch’s orientation every 0.1 seconds. This orientation should be added to the end of listOfOrientations.
- The Finch should remain in record mode until the user presses the spacebar.
- When the Finch is in record mode, its beak should be red.
- When the Finch leaves record mode, its beak should turn off (no light).
Next, write a script that will control the Finch when it is in play mode. The script for this mode should move through listOfOrientations. For each orientation in the list, the Finch should make a movement. The requirements for play mode are listed below.
- The play mode should start when the user presses the ‘p’ key.
- The script should move through each item in listOfOrientations.
- The Finch orientations (Beak Up, Beak Down, Left Wing Down, Right Wing Down, and Level) should correspond to different movements of the robot. For example, Level should correspond to stopping the Finch. You should make the other four orientations correspond to these four Finch movements: forward, back, turn right, and turn left. You may choose which orientation corresponds to each movement. The robot should do nothing for the Upside Down and In Between orientations.
- The repeat block should include a 0.1 second wait.
- When the Finch is in play mode, its beak should be green.
- When the Finch leaves play mode, its beak should turn off (no light).
When you have a working project, be sure to find some younger students to try it out!
Extension: Choose new movements to correspond to different tilts of the Finch, or maybe you would prefer to add lights and sound to your program. Use your imagination!