List of all members.
Constructor & Destructor Documentation
Constructs a Finch object Calling this constructor automatically connects the program to the robot, and launches a second thread to prevent the Finch from timing out and returning to idle mode before the program ends.
| Finch::~Finch |
( |
| ) |
[virtual] |
Destructs a Finch object Destructor calls the disConnect function, which closes the connection and returns Finch to an idle state.
Member Function Documentation
Connects to a Finch object. Called by the constructor. Left public for creative uses, but in general should not be used independent of the constructor.
- Returns:
- -1 if connection failed, 1 if connection succeeded.
Used by the keep alive method, left public for creative uses but not ordinarily used by the user. This function reads the Finch's ping method, which simply returns the number of times the Finch has been pinged (a number from 0 to 255, overflow returns the value to 0).
- Returns:
- Number of times the counter method has been called, -1 if read failed.
| int Finch::disConnect |
( |
| ) |
|
Tells Finch to go back to idle mode, then closes the connection
- Returns:
- a positive number if resetting the Finch succeeded, -1 if it failed
| int Finch::finchRead |
( |
unsigned char |
bufToWrite[], |
|
|
unsigned char |
bufRead[] |
|
) |
| |
Generic function to read data from the Finch.
- Parameters:
-
| bufToWrite | 9-byte array to send to Finch to indicate what should be read. |
| bufRead | 9-byte array containing raw returned value from Finch |
- Returns:
- -1 if read failed, 1 is read succeeded.
| int Finch::finchWrite |
( |
unsigned char |
bufToWrite[] | ) |
|
Generic write-only method, used for set functions that don't expect returned data.
- Parameters:
-
| bufToWrite | A 9 byte array containing the command report. |
- Returns:
- A positive number of the write succeeded, -1 if it failed.
| double * Finch::getAccelerations |
( |
| ) |
|
Gets the X, Y, and Z acceleration values in G's experienced by the Finch's accelerometer
- Returns:
- An array of 3 doubles holding X, Y, and Z acceleration, null if the read failed.
| int Finch::getLeftLightSensor |
( |
| ) |
|
Returns the value of the left light sensor.
- Returns:
- Intensity of light falling on left light sensor, values range from 0-255. -1 if read failed.
| int * Finch::getLightSensors |
( |
| ) |
|
Gets the left and right light sensor values. Values range from 0 to 255 with higher values indicating more light.
- Returns:
- An array of two values holding the left and right light sensor values, null if read failed.
| int * Finch::getObstacleSensors |
( |
| ) |
|
Gets the state of the left and right obstacle sensors. 0 if the sensor does not detect an obstacle, 1 if it does.
- Returns:
- An array of two values holding the left and right obstacle sensor values, null if read failed.
| int Finch::getRightLightSensor |
( |
| ) |
|
Returns the value of the right light sensor.
- Returns:
- Intensity of light falling on right light sensor, values range from 0-255. -1 if read failed.
| double Finch::getTemperature |
( |
| ) |
|
Gets the temperature as measured by the Finch's thermometer
- Returns:
- The temperature in degrees Celcius, -1 if the read failed.
| double Finch::getXAcceleration |
( |
| ) |
|
The value in G's of acceleration along the Finch's X-axis (beak to tail)
- Returns:
- The value in G's of acceleration along the Finch's X-axis (beak to tail), valid values range from -1.5 to 1.5, a value of -2 indicates read failed.
| double Finch::getYAcceleration |
( |
| ) |
|
The value in G's of acceleration along the Finch's Y-axis (wheel to wheel)
- Returns:
- The value in G's of acceleration along the Finch's Y-axis (wheel to wheel), valid values range from -1.5 to 1.5, a value of -2 indicates read failed.
| double Finch::getZAcceleration |
( |
| ) |
|
The value in G's of acceleration along the Finch's Z-axis (bottom to top)
- Returns:
- The value in G's of acceleration along the Finch's X-axis (bottom to top), valid values range from -1.5 to 1.5, a value of -2 indicates read failed.
| int Finch::isBeakDown |
( |
| ) |
|
This method returns true if the beak is pointed at the floor, false otherwise
- Returns:
- 1 if beak is pointed at the floor, 0 if not, -1 if reading failed.
This method returns 1 if the beak is up (Finch sitting on its tail), 0 otherwise
- Returns:
- 1 if beak is pointed at ceiling, 0 if not, -1 if reading failed
| int Finch::isFinchLevel |
( |
| ) |
|
This method returns true if the Finch is on a flat surface
- Returns:
- 1 if the Finch is level, 0 if not, -1 if reading failed.
| int Finch::isFinchUpsideDown |
( |
| ) |
|
This method returns true if the Finch is upside down, false otherwise
- Returns:
- 1 if Finch is upside down, 0 if not, -1 if reading failed.
| int Finch::isLeftWingDown |
( |
| ) |
|
This method returns true if the Finch's left wing is pointed at the ground
- Returns:
- 1 if Finch's left wing is down, 0 if not, -1 if reading failed.
| int Finch::isObstacleLeftSide |
( |
| ) |
|
Returns the state of the left obstacle sensor
- Returns:
- The state of the left obstacle sensor: 1 for obstacle exists, 0 for no obstacle, -1 for read failed.
| int Finch::isObstacleRightSide |
( |
| ) |
|
Returns the state of the right obstacle sensor
- Returns:
- The state of the right obstacle sensor: 1 for obstacle exists, 0 for no obstacle, -1 for read failed.
| int Finch::isRightWingDown |
( |
| ) |
|
This method returns true if the Finch's right wing is pointed at the ground
- Returns:
- 1 if Finch's right wing is down, 0 if not, -1 if reading failed.
| void Finch::keepAlive |
( |
| ) |
|
Not for use by user. The function called to keep the Finch from moving into idle mode while a program is running.
Turns off the Finch's buzzer.
- Returns:
- a positive number if the buzzer was turned off, -1 if the command failed.
| int Finch::noteOn |
( |
int |
frequency | ) |
|
Turns on the Finch's buzzer to beep at a certain frequency
- Parameters:
-
| frequency | The frequency in Hertz to beep at |
- Returns:
- a positive number if the buzzer was set, -1 if the command failed.
| int Finch::noteOn |
( |
int |
frequency, |
|
|
int |
duration |
|
) |
| |
Turns on the Finch's buzzer to beep at a certain frequency for a certain period of time. This command blocks program execution by the amount of time specified by duration.
- Parameters:
-
| frequency | The frequency in Hertz to beep at |
| duration | The duration in milliseconds to hold the note for. |
- Returns:
- a positive number if the buzzer was set, -1 if the command failed.
| int Finch::setLED |
( |
int |
red, |
|
|
int |
green, |
|
|
int |
blue |
|
) |
| |
Sets the color and intensity of the beak LED.
- Parameters:
-
| red | Intensity of the red color element, range is 0 to 255 |
| green | Intensity of the green color element, range is 0 to 255 |
| blue | Intensity of the blue color element, range is 0 to 255 |
- Returns:
- a positive number if the LED was set, -1 if the command failed.
| int Finch::setMotors |
( |
int |
leftWheelSpeed, |
|
|
int |
rightWheelSpeed, |
|
|
int |
duration |
|
) |
| |
Sets the speed of the left and right wheels for a specified period of time, after which they turn off. This function blocks program execution by the amount of specified by duration.
- Parameters:
-
| leftWheelSpeed | Power to the left wheel, range is -255 to 255 |
| rightWheelSpeed | Power to the right wheel, range is -255 to 255 |
| duration | The time in milliseconds to maintain the set speeds |
- Returns:
- a positive number if the motors were set, -1 if the command failed.
| int Finch::setMotors |
( |
int |
leftWheelSpeed, |
|
|
int |
rightWheelSpeed |
|
) |
| |
Sets the speed of the left and right wheels.
- Parameters:
-
| leftWheelSpeed | Power to the left wheel, range is -255 to 255 |
| rightWheelSpeed | Power to the right wheel, range is -255 to 255 |
- Returns:
- a positive number if the motors were set, -1 if the command failed.
Returns if the Finch was shaken since the last call to wasShaken (no matter how long ago that may have been), or since the start of the program if this is the first call to wasShaken.
- Returns:
- 1 if the Finch was shaken, 0 if not, -1 if the read failed.
Returns if the Finch was tapped since the last call to wasTapped (no matter how long ago that may have been), or since the start of the program if this is the first call to wasTapped.
- Returns:
- 1 if the Finch was tapped, 0 if not, -1 if the read failed.
The documentation for this class was generated from the following files: