Print

ScratchScratch Finch Basics

Lesson Key

Lesson key available for teachers.

Start by watching the video below to learn how to open Scratch when using the Finch.

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.

Then open the Birdbrain Robot Server (or the Finch Connection App, if you are using a Chromebook). This program must remain open the entire time that you are programming in Scratch. It is like a translator between Scratch and your Finch.

The BirdBrain Robot Server should tell you that your Finch is connected. Click Open Scratch.

NOTE: On a Mac, the USB cord for the Finch must be plugged in before you open the BirdBrain Robot Server.

Programming in Scratch

This is the Scratch window. It has a few different parts. To write a program, you will drag blocks from the Blocks area to the Scripts area. In Scratch, programs are also called scripts. You can use Scratch to write scripts that use the Finch or scripts that use cartoon characters called sprites. This lesson will focus on the Finch.

The Blocks area in Scratch contains 10 different menus – Motion, Looks, Sound, etc. Click on the different menus to get an idea of the blocks that they contain. All the Finch blocks are located in the More Blocks menu in Scratch.

Saving Your Work

It is very important to save your work often! Otherwise, you might lose something important. Watch this video to learn how to save a program.

To save a new project in Scratch, click on File and then Save as (Save Project for Chromebooks using ScratchX). Give your project a name and then click Save. Once your project has a name, you can save it by going to File and then Save.

DO NOT name your Scratch file FinchStart. This will overwrite the blank file that should appear when you open Scratch from the Birdbrain Robot Server.

Moving the Finch

To move and turn the Finch, you will use 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.

The Move Finch block makes the Finch start moving. Drag a Move Finch block into the Scripts area and set both number to 50. This is your first program! Click on this block to run your program. The Finch will start moving forward. You may need to pick it up to keep it from driving off the table.

Exercise 1:

Change each 50 to 0 and click the Move Finch block again. This should make the Finch stop moving.

Events

So far, you have been running your program by clicking on it. You can also use an event to start a program. An event is an action that the computer can recognize. For example, you might press a key on the keyboard. Click on the Events menu.

The second block on this menu is when key pressed. Drag this block into your program until it connects to the top of your script. Notice that the shape of this block shows you that it must be at the top of a script. It can’t be connected below another block.

Now you can run your program by pressing the spacebar. Try using the spacebar to make the Finch move. You can click the stop sign in the upper left corner of the Stage to stop the Finch.

Click on the black triangle in the when key pressed block. A menu will pop up that will allow you to select other keys. Modify your program so that the Finch moves forward when you press ‘o.’

Exercise 2:

You may have already discovered that you can write multiple scripts in the Scripts area. Add a second script that stops the Finch when you press ‘x.’

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.

Creating Longer Scripts

The wait block can be found on Control menu. This block pauses the program for the number of seconds shown in the block. This number can be a whole number or a decimal number.

You can use the wait block to move the Finch for a certain period of time. For example, this program will make the Finch drive forward for three seconds and then stop.

Exercise 3:

Try out the program below. 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.

Exercise 4:

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 5:

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

Exercise 6:

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

Loops

Think about how you might make the Finch turn back and forth repeatedly. One way to do this would be to use a long sequence of commands, but it is much simpler to use the forever block in the Control menu. This block is called a loop. A loop is a programming structure that repeats a portion of a program. Look at the Control menu. Which of the other blocks do you think might be loops?

Other blocks can be placed inside the forever block. The forever block repeats the blocks inside it until you press the stop sign to stop the program. This loop makes the Finch turn left and right. The loop repeats the four blocks inside it over and over. After the second wait block, the program immediately goes back to the first block inside the loop, the block that turns the Finch to the left. What happens if you remove the second wait block?

The repeat block is a loop that repeats the blocks inside it a certain number of times. For example, this program makes the Finch turn left and right ten times. To stop the Finch at the end of the script, you need to add a command below the repeat block.

Exercise 7:

Use a loop to make the Finch drive in a square. What actions does the Finch need to repeat? How many times should it repeat them? Note: It is hard to turn precisely with the Finch; the angles on your square do not need to be perfect.

Programming Tip:

To make your Finch turn more reliably, you should program it to turn slowly (speed 20-40). Also, don’t forget to hold the Finch’s cord while it is moving!

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 8:

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

Exercise 9:

Write a program to make the beak blink on and off repeatedly in your favorite color.

Programming Tip:

When Scratch 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 10:

Write a program that uses two Speak blocks. What block do you need to place between your Speak blocks?

Exercise 11:

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

Conclusion

You have learned how to use all the Finch outputs! Watch this video to review before completing the last exercise in this lesson.

Exercise 12:

Practice all of the things you have learned in this lesson by making the Finch move in a geometric shape, such as a triangle 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 (Hint: Explore the pick random block in the Operators 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! The corners of the shape will be rounded because the marker is attached to the Finch’s tail, rather than at its turning point.