|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object GreenFinch
public class GreenFinch
A simplified version of the finch object. If you want the full capabilities of the finch object then you can call the getFinchObject() method which returns the original finch backing this GreenFinch.
This class is a singleton class, you don't create new instances of it since there's only one Greenfinch. Instead, call the get() method like so:
GreenFinch finch = GreenFinch.get();
You can then call any of the desired methods on this finch.
Method Summary | |
---|---|
void |
buzz(int freq,
int duration)
Tell the finch to buzz at the given frequency for a certain amount of time. |
static GreenFinch |
get()
Get the instance of the GreenFinch. |
Finch |
getFinchObject()
Get the finch object underlying this GreenFinch. |
int |
getLeftLightLevel()
Get the left light level as measured by the finch. |
int |
getLightLevel()
Get the overall light level as measured by the finch. |
int |
getRightLightLevel()
Get the right light level as measured by the finch. |
double |
getTemperature()
Get the current temperature as measured by the finch in degrees celcius. |
double |
getXAcceleration()
Get the value of the X acceleration the finch is currently experiencing. |
double |
getYAcceleration()
Get the value of the Y acceleration the finch is currently experiencing. |
double |
getZAcceleration()
Get the value of the Z acceleration the finch is currently experiencing. |
boolean |
isLeftHit()
Determine if the left-hand infrared sensor is registering something directly in front of it. |
boolean |
isRightHit()
Determine if the right-hand infrared sensor is registering something directly in front of it. |
void |
setLED(java.awt.Color color)
Set the LED on board the finch to a certain color. |
void |
setLED(int red,
int green,
int blue)
Set the LED on board the finch to a certain color. |
void |
setWheelSpeeds(int left,
int right)
Set the left and right wheel speeds of the finch. |
protected void |
start()
Start the finch. |
protected void |
stop()
Stop the finch. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static GreenFinch get()
public double getXAcceleration()
public double getYAcceleration()
public double getZAcceleration()
public boolean isLeftHit()
public boolean isRightHit()
public void setLED(java.awt.Color color)
color
- the colour to set the finch's LED to.public void setLED(int red, int green, int blue)
red
- Intensity of the red LED (range is 0-255)green
- Intensity of the green LED (range is 0-255)blue
- Intensity of the blue LED (range is 0-255)public double getTemperature()
public int getLightLevel()
public int getLeftLightLevel()
public int getRightLightLevel()
public void buzz(int freq, int duration)
frequency
- Hz that the finch should buzz at.duration
- length of time the buzz should
occur for, in ms (1000ms = 1s.)public void setWheelSpeeds(int left, int right)
left
- the speed of the left wheel.right
- the speed of the right wheel.protected void start()
protected void stop()
public Finch getFinchObject()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |