Graphing with Finch
This activity was created by Dianne O'Grady-Cunniff of Charles County Public Schools.
You have learned to use the Finch sensors to move a sprite on the screen. In this activity, you will use the commands on the Pen menu to graph the value of a sensor over time.
Start by writing a program that uses the block below to move the sprite on the screen. What numbers do you need to put in the blanks so that the sprite moves all the way to the top and the bottom of the screen?
Now you want to record the path of the sprite on the screen. Explore the commands under the Pen menu. Start with the pen down block; you can think about this block as placing a pen on the "paper" of the screen. How can you change the color of the sprite's path?
You have a program that tracks the value of the light sensor. To create a graph, you need to start with the sprite on the left side of the screen and gradually increase the x-coordinate as you change the y-coordinate. At the very beginning of your script, add a command that will make the sprite start at (-240, 0).
Within your loop, add a block that will increase the value of the x-coordinate by one pixel each time through the loop. When you run your program, you should see a graph that looks something like the one shown below.
Extension: Can you add axes to your graph? Can you graph the light value for exactly 30 seconds?