Finch Methods Practice Assignments

Overview

We will use the Finch robots to explore instantiating classes to create an object and calling methods on that object. For these practice assignments, you can work in pairs to complete them.

Resources

BirdBrain Java Library

To control the Finch robots, you will need to create a Finch object. To compile your code (that has references to the Finch class), the compiler will need access to the files in the BirdBrain Java Library. To do so, you can import that library using BlueJ, Eclipse, or your favorite IDE. Then, put:

import BlueBirdJava.Finch;
at the top of your file. Alternatively, you can just put the .java in the same directory as your file. Alternatively, you can import that library into your project with your IDE. (Here's a link to instructions for the Eclipse IDE.) Descriptions for each of the methods in the Finch class are posted at https://learn.birdbraintechnologies.com/finch/java/library/.

Connecting to the Robot

After successfully compiling your code with the BirdBrain Java Library, you need to be connected to your robot in order for your program control it. The BlueBird Connector is a program that connects to your robot via Bluetooth. If you are using your own computer, you can download BlueBird Connector from HERE. Instructions for using BlueBird Connector can be found HERE.

Submission Instructions

To submit, show your Java code and demonstrate your program working correctly on the robot to either the GLA or the instructor.

Practice Assignments

FinchTest

Included in the BirdBrain Java library is FinchTest.java. Make sure that you can compile and execute this program and that it plays a sound and makes the peak flash 10 times. Follow the directions in the Submission Instructions section to get points for this.

Game Spinner

Many games have spinners, objects that spin around to produce a "random" value. Program a Finch robot to spin around a random amount (after at least one full revolution).

As an optional challenge, illuminate an additional tail light for each complete revolution.

Dance Moves

Write a Java program that will "dance" around. Include multiple movements, lights and sound.

Remote Control

The Finch robots have built in accelerometer. Write a Java program that uses one Finch robot as a remote control for another Finch robot. Have the remote control make the other robot turn left or right and speed up or slow down.