Print

JavaJava: Lesson 2 – Moving the Finch Forward and Back

Resources

Resources available for teachers.   

To make the Finch move and turn, you can use the setWheelVelocities() method. This method requires three parameters. The first controls the speed of the Finch’s left wheel, the second controls the speed of the right wheel, and the third sets the time in milliseconds that the Finch should move.

Exercise 1:

Create a new file named “FinchForward.java” and try out the command shown above. It should make the Finch move forward for 1 second.

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

Try changing the time that the Finch should move. Can you make the Finch move forward for 5 seconds?

Exercise 3:

Both speed parameters must be between -255 and 255. To make the Finch move in a straight line, the speeds for the two wheels should be the same. Try out the code shown below. How does the Finch move?

Exercise 4:

You can program the Finch to make a sequence of movements. The commands below will make the Finch move forward first at speed 75, then at speed 150, and then at speed 225. Try out this sequence. Then modify it so that the Finch moves backward instead of forward.

Exercise 5:

Write a program that makes the Finch move forward, then backward, then forward, and then backward again. The robot should pause for half a second between each movement.

Exercise 6:

Write a program that moves the Finch at five different speeds. The Finch should move for 4 seconds total.

Exercise 7:

Write a program that asks the user for the Finch speed and then moves the Finch at that speed.

Exercise 8:

Write a program that asks the user how many seconds the Finch should move and then moves the Finch forward for that number of seconds. The Finch should also speak the number of seconds that it is moving.