import finch.Finch; /** * Lab 2 * CS 2334 * Sep 2, 2010 *
* TestFinch: a class that allows us to test the installation of our * Finch driver, the connection to the Finch, and our use of the * Finch API. * *
* @version 1.0 * @author DO NOT SPECIFY AN AUTHOR */ public class TestFinch { public static void main(String args[]){ Finch myFinch = null; // Connect to the Finch myFinch = new Finch(); // Set nose to RED myFinch.setLed(255, 0, 0); // Pause for 1000 milliseconds myFinch.sleep(1000) // Set nose to GREEN myFinch.setLED(0, 255, 0); myFinch.sleep(1000); // Wait for the beak to be pointed down while(!myFinch.isBeakDown()){}; // Set nose to BLUE myFinch.setLED(0, 0, 255); myFinch.sleep(1000); // Back to RED myFinch.setLED(255, 0, 0); // Wait for a little bit myFinch.sleep(5000); // Shut down the connection to the Finch (necessary!) myFinch.Quit(); } }