# Snap! 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 using the Birdbrain Robot Server to open Snap! Details are shown in the video Snap! Programming w/ Finch: Intro. For this lesson, you should select Snap! Level 4 (the default).

## Moving the Finch

Now that you have learned some of the basics of Snap!, you are ready to start using the Finch. We will start by moving the Finch forward. The blocks to move the Finch are at the bottom of the Motion menu. They are the Move Finch and the Stop Finch blocks.

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 Stop Finch block does exactly what it sounds like; it makes the Finch stop moving.

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 (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

The Looks menu contains a block that you can use to change the color of the Finch’s beak. This is the Finch LED block. 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 block requires three numbers, which are labelled RG, and BR 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 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 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

Using the Finch adds three blocks to the Snap! Sound menu. The Say This block will cause the computer to speak whatever text you type into the block.

The Finch Buzzer 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 immediately on to the next block. The Finch Buzzer + Wait block, on the other hand, will stop the program until the sound is done playing. Then the program will move on to the next block.

Exercise: Use the Finch buzzer 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! If you need to review how to export a file in Snap!, watch Snap! Level 4 Programming: Saving and Exporting.

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