Scratch Finch Basics

Use the USB cord to connect the Finch to the computer. In order for the Finch to run a program, this cord must always be attached to the robot and to the computer.

Start by opening the Birdbrain Robot Server. It should show that your Finch is connected. Then click Open Scratch.

Moving the Finch

The Scratch blocks for the Finch are located in the More Blocks menu. We will start by moving the Finch forward using the Move Finch block.

The Finch has two motors, one for each wheel. The Move Finch block enables you to start these motors. The block requires two numbers. These numbers represent the speed of the left and right motors. Each number can be any whole number from ­-100 to 100. This block makes the Finch start moving. Another Move Finch block is needed to stop it. To stop the Finch, use a Move Finch block with both motor speeds equal to 0.

Exercise: Try out the program below (the wait block is in the Control menu). It should move the Finch forward for three seconds. Then try several motor speeds between 0 and 100 in the first Move Finch block (keep the speeds of the left and right motors the same). Describe two ways that you can change how far the Finch moves.

Tip: You may need to carry the USB cord as the Finch moves. Otherwise, the cord may keep the Finch from moving and turning freely.

Exercise: What does it mean for the speed to be negative? Try several motor speeds between 0 and -100 (keep the speeds of the left and right motors the same).

Turning the Finch

So far, the speeds of the left and right motors have been equal. When these speeds are equal, the robot moves in a straight line. When the speeds are not equal, the Finch will turn.

Exercise: Try the two programs shown below. How are these two turns different? How can you make the robot turn in the other direction?

Exercise: Write a program that makes the robot turn a full circle to the left and then a half circle to the right.

Color with the Finch

You can use the Finch LED color block 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. The Finch LED color block requires three numbers, which are labelled R, G, and B. R controls the amount of red light from 0 (none) to 100 (maximum brightness). G and B control the amount of green and blue light, respectively, from 0 to 100.

Exercise: What do you think the program below will do? After you make a hypothesis, try it and find out.

Exercise: Modify this program so that beak blinks on and off repeatedly in your favorite color. What Control block can you use to do this?

Tip: When Snap! reaches a Finch LED color block, it sets the beak and moves immediately to the next block. This means that if you do not have a wait block between two Finch LED color blocks, you may not see the effects of the first block. For example, you may not see the LED turn on when you run the script below. The same is true for the Move Finch blocks; a pair of Move Finch blocks should have a wait block between them.

Sound with the Finch

The More Blocks menu for the Finch contains two sound blocks. The Speak block will cause the computer to speak whatever text you type into the block.

The Finch buzz block activates the Finch’s buzzer. This block requires two numbers. The number on the left (Hz) gives the frequency of the sound; keep in mind that humans can only hear sounds in the range of 20 to 20,000 Hz. The number on the right (ms) gives the length of the sound in milliseconds. This block will start the buzzer and then move on immediately to the next block.

Exercise: Use the Finch buzz and wait blocks to make the Finch play a short song.

Exercise: Practice all of the things you have learned in this lesson by making the Finch move in a triangle, square, or pentagon. The Finch should buzz as it starts each side of the shape. For an added challenge, make the beak change to a different random color for each side of the shape.

Make sure to save your work! To save a file in Scratch, click the File menu and select Save as. To update a file you have already saved, use the Save option under the File menu.

Tip: Use the indentation in the Finch’s tail to attach a marker with tape or velcro. Then the Finch will draw your shape!