Sunteți pe pagina 1din 5

Name 1: Faizan Rozani

Name 2: Alyssa Matthews

Sensing with Finch


For each exercise, answer the questions in red.

Following the Light

In the first lesson, you learned to use the Finch outputs: the motors, lights, and buzzer on the Finch. The Finch
also has sensors that provide input to the robot. A sensor makes measurements and sends them to the
program that the Finch is running. The program can use the sensor information to set outputs or make a
decision. The Finch has two light sensors, an acceleration sensor (accelerometer), two obstacle sensors, and
a temperature sensor.

The Sensing menu in Snap! contains the blocks for the Finch sensors. The Finch Left Light Sensor and the
Finch Right Light Sensor blocks can be used to measure the values of the two light sensors. Each of these
blocks has a value from 0 (no light) to 100 (maximum light).

Exercise: Drag a light sensor block into the Scripts area. Click on the block to see the current value of the
sensor. Next, cover the light sensor with your hand and click on the block again. You should see the value of
the light sensor change. What is the value of the block when you shine a flashlight on the sensor?

With no cover 22,19

Cover 8,5
Name 1: Faizan Rozani
Name 2: Alyssa Matthews
Light is 45, 27

You can use the sensor blocks to make the robot respond to its environment. For example, you can make the
speed of the robot depend upon the value of the light sensors using the block shown below.

This block will set the speed of the robot using the values of the light sensors. However, this will only happen
once. If you want the speed of the robot to change when the sensor value changes, you need to use a loop.
Use a flashlight to try out the program shown below. (you may use your smartphone flashlight).

Did your Finch move too slow or too fast? You can use math to change that!

Using Math with the Finch

In the Operators menu, Snap! contains blocks that you can use to do arithmetic.

You can use the multiplication block to make the robot move twice as fast.

Exercise: Try out the arithmetic blocks to make your robot follow the flashlight as quickly as possible. The
Finch should not move when the flashlight is not shining on it.

The robot would move somehow with the class lights on.
Name 1: Faizan Rozani
Name 2: Alyssa Matthews
Exercise: Why is the speed of the left motor controlled by the right sensor? What happens when the speed of
the motor is controlled by the sensor on the same side?

The speed of the left motor is controlled by the right sensor because thats the way it is. When the speed of the
motor is controlled by the sensor on the same side, the finch wouldnt move.

Tip: You can also place arithmetic blocks inside one another. When you do this, the operation in the innermost
block will be performed first. In the expression below, the 2 and 4 will be added together first, and then the
result will be multiplied by 10. What will be value of this expression be? Make a hypothesis and then test it in
Snap!. Remember, you can click on a block to find the value of the block.

Exercise: Program your Finch to avoid light instead of following it.

You would use if then blocks and stop finch blocks to make this happen.

Temperature Sensor

There are also two Finch blocks that can be used for measuring temperature. What is the temperature in your
room in Celsius and in Fahrenheit? Can you raise the temperature reading of the sensor?

Exercise: Use the temperature sensor to set the color of the Finchs beak.

We set the temperature to if 100> fahrenheit then green and if 30< celcius then blue and it changed to green:

Accelerometer

The last blocks that we will use in this lesson measure acceleration. These blocks measure how much the
Finch is tilted. When the Finch is sitting on a flat surface, these blocks will not change.

There are three different blocks because the Finch can measure tilt in three different directions. The value of
each block is a decimal number between -1.5 and 1.5.
Name 1: Faizan Rozani
Name 2: Alyssa Matthews

Exercise: Create three variables. Use the program below to continually change these variables to the values of
the acceleration blocks. Tilt the Finch in different directions. What type of tilt makes each variable change?

Any tilt that is made will change the coordinates:

Exercise: Use one of the acceleration blocks (or one of your variables) to move the sprite on the screen. You
will need to use a move block with the acceleration block inside it. You may also want to use the arithmetic
blocks.

We used:
Name 1: Faizan Rozani
Name 2: Alyssa Matthews

S-ar putea să vă placă și