The Finch is a robot designed specifically for students learning computer science. You can write programs to move and turn the Finch, light up its beak, and collect information with its sensors. As you write programs, you will be able to test your programs with the Finch in the real world!
Lesson 1 – Moving and Turning
Importing a library, declaring an object, using object methods
Importing the Finch Library and Declaring a Finch
First, connect to the Finch in the BlueBird Connector, and then open a new file in Python. Make sure that this file is inside the BirdBrainPython folder that contains BirdBrain.py. To use the Finch in Python, you must import the Finch class from the BirdBrain library. A library in Python is a collection of Python code that you can use in your program, and the Finch class contains the methods that you will use to write programs that use the Finch.
Moving Forward and Backward
All of these parts are shown together in the sample program below. This sample program will move the Finch forward 10 cm at 50% of maximum speed. You can use the # sign to add comments to your program. Comments do not affect how your program works, but they make it easier for other people to use your code (and for you to remember what it does).
Name your file FinchMoveTurn.py and try out the sample code shown above (remember to save the file within the BirdBrainPython folder). Try out other values for the distance and speed parameters.
Write a program that makes the Finch move forward, then backward, then forward, and then backward again. The robot should end 15 cm behind where it started.
Turning the Finch
Write a program that makes the robot turn left in a full circle and then right in a full circle. The two turns should be at different speeds.
Write a program that makes the Finch move in a square and return to where it started.
Draw a simple picture with the Finch. You can place a marker through the hole in the Finch to draw your picture on a large sheet of paper. We highly recommend using a brush tip marker with the Finch. These markers work well. If you use a marker with a harder tip, the friction of the marker may make your drawing less accurate.