Finch Constructor Summary
Finch() 
Method Summary
buzz(int frequency, int duration) 
Plays a tone at the specified frequency for the specified duration on the Finch's internal buzzer. Middle C is about 262Hz. Note that this is different from playTone, which plays a tone on the computer's speakers. Also note that buzz is non-blocking - so if you call two buzz methods in a row without an intervening sleep, you will only hear the second buzz (it will over-write the first buzz).
getLeftLightSensor() 
Returns the value of the left light sensor. Valid values range from 0 to 255, with higher values indicating more light is being detected by the sensor.
getRightLightSensor() 
Returns the value of the right light sensor. Valid values range from 0 to 255, with higher values indicating more light is being detected by the sensor.
getTemperature() 
The current temperature reading at the temperature probe. The value returned is in Celsius. To get Fahrenheit from Celsius, multiply the number by 1.8 and then add 32.
isBeakDown() 
This method returns true if the beak is pointed at the floor, false otherwise
isBeakUp() 
This method returns true if the beak is up (Finch sitting on its tail), false otherwise
isFinchLevel() 
This method returns true if the Finch is on a flat surface, false otherwise
isFinchUpsideDown() 
This method returns true if the Finch is upside down, false otherwise
isLeftWingDown() 
This method returns true if the Finch's left wing is pointed at the ground, false otherwise
isObstacle() 
Returns true if either left or right obstacle sensor detect an obstacle.
isObstacleLeftSide() 
Returns true if there is an obstruction in front of the left side of the robot. The obstacle must be close (1.5 to 6 inches) and reflective, and slightly off to the left side.
isObstacleRightSide() 
Returns true if there is an obstruction in front of the right side of the robot. The obstacle must be close (1.5 to 6 inches) and reflective, and slightly off to the right side.
isRightWingDown() 
This method returns true if the Finch's right wing is pointed at the ground, false otherwise
isShaken() 
Returns true if the Finch has been shaken since the last accelerometer read
isTapped() 
Returns true if the Finch has been tapped since the last accelerometer read
playClip(String fileLocation) 
Plays a wav file over computer speakers from the specificied fileLocation path. If you place the audio file in the same path as your source, you can just specify the name of the file, otherwise use the absolute path of the file.
playTone(int frequency, int duration) 
Plays a tone over the computer speakers or headphones at a given frequency (in Hertz) for a specified duration in milliseconds. Middle C is about 262Hz. Visit http://www.phy.mtu.edu/~suits/notefreqs.html for frequencies of musical notes.
playTone(int frequency, int volume, int duration) 
Plays a tone over the computer speakers or headphones at a given frequency (in Hertz) for a specified duration in milliseconds at a specified volume.
Middle C is about 262Hz. The volume of the tone is on a 1 to 10 scale
quit() 
This method properly closes the connection with the Finch and resets the Finch so that it is immediately ready to be controlled by subsequent programs. Note that if this method is not called at the end of the program, the Finch will continue to act on its most recent command (such as drive forward) for 5 seconds before automatically timing out and resetting. This is why we recommend you always call the quit method at the end of your program.
saySomething(String sayThis) 
Takes the text of 'sayThis' and synthesizes it into a sound file and plays the sound file over computer speakers. sayThis can be arbitrarily long and can include variable arguments. Example: myFinch.saySomething("My light sensor has a value of "+ lightSensor + " and temperature is " + tempInCelcius);
saySomething(String sayThis, int duration) 
Takes the text of 'sayThis' and synthesizes it into a sound file and plays the sound file over computer speakers. The duration argument allows you to delay program execution for a number of milliseconds.
setLED(Color color) 
Sets the color of the LED in the Finch's beak using a Color object.
setLED(Color color, int duration) 
Sets the color of the LED in the Finch's beak using a Color object for the length of time (in milliseconds) specified by duration.
setLED(int red, int green, int blue) 
Sets the color of the LED in the Finch's beak. Valid ranges for the red, green, and blue elements are 0 to 255.
setLED(int red, int green, int blue, int duration) 
Sets the color of the LED in the Finch's beak for the length of time (in milliseconds) specified by duration.
setWheelVelocities(int leftVelocity, int rightVelocity) 
This method simultaneously sets the velocities of both wheels. Current valid values range from -255 to 255; negative values cause a wheel to move backwards.
setWheelVelocities(int leftVelocity, int rightVelocity, int timeToHold) 
This method simultaneously sets the velocities of both wheels. Velocities from -255 to 255, negative is backwards
If timeToHold is positive, this method blocks further program execution for the amount of time specified by timeToHold, and then stops the wheels once time has elapsed.
sleep(int ms) 
This method uses Thread.sleep to cause the currently running program to sleep for the specified number of milliseconds.
stopWheels() 
Stops both wheels.

Authors: Tom Lauwers (tlauwers@birdbraintechnologies.com), Chris Bartley (bartley@cmu.edu)