Make the Finch move in a spiral!
This activity addresses Common Core math standards that deal with variables (6.EE.A, 6.EE.B, and 7.EE.B). At the high school level, this activity can be used as an example of a simple function (HSF.IF.B and HSF.BF.A).
When the Finch’s two motors move at the same speed, it moves in a straight line. When they move at different speeds, it moves in a circle.
Write a program that makes the Finch move in a circle with the left wheel at 60 and the right wheel at 15. What is the approximate radius of the circle? You may want to attach a marker to the Finch as shown in DrawBot.
Modify your program so that the left wheel moves at 60 and the right wheel moves at 50. What is the radius of the circle now?
Next, try out a repeat block. You can find this block on the Control menu. The repeat block repeats whatever is inside if a specific number of times. For example, the script below makes the Finch beak blink on and off five times. Try it out!
To make the Finch draw a spiral, you want to gradually change the speed of the right wheel. You can do this using a variable. To create a variable, go to the Data menu in Scratch (Variables menu in Snap) and click Create a Variable. The New Variable window will appear. Call the variable “speed” and click OK.
You will notice that the Data/Variables menu looks different now. Now it contains a block for your variable. Also, the value of the variable is shown in the top-left corner of the stage.
Before you use a variable in a program, you should always give it a value. This is called initializing the variable. To initialize the variable, use the set to block. Be sure the click on the black arrow in this block to select the name of your variable.
You will use the repeat block to gradually increase your speed variable. An example is shown below. What will be the value of speed at the end of the script?
Modify this script so that the Finch moves for 1 second for each value of speed. The speed of the right wheel should be speed, while the speed of the left wheel should be fixed at 60. What number should you place in the repeat block to make the final value of speed equal to 50? Remember to stop the Finch at the end of the program.
Once you have a basic spiral, see what variations you can make! This picture was made with a long-exposure photograph of an LED attached to the Finch.