Go to the source code of this file.
|
#define | _LINUX_ |
| Sets the API for use with Mac or Linux, comment out if using Windows.
|
|
#define | Sleep(mm) usleep(mm*1000) |
| If using Linux/Mac, redefines sleep to match that OS call.
|
|
|
int | Fin_Init (void) |
| Fin_init(void).
|
|
int | Fin_Exit (void) |
| Fin_Exit(void).
|
|
int | Fin_Motor (int tenth, int left, int right) |
| Fin_Motor(tenth, left, right).
|
|
int | Fin_Move (int tenth, int left, int right) |
| Fin_Move(tenth, left, right).
|
|
int | Fin_Speed (int *left, int *right) |
| Fin_Speed(*left, *right).
|
|
int | Fin_LED (int red, int green, int blue) |
| Fin_LED(red, green, blue).
|
|
int | Fin_Buzzer (int msec, int freq) |
| Fin_Buzzer(msec, freq).
|
|
int | Fin_Lights (int *left, int *right) |
| Fin_Lights(*left, *right).
|
|
int | Fin_Obstacle (int *left, int *right) |
| Fin_Obstacle(*left, *right).
|
|
int | Fin_Temp (float *temp) |
| Fin_Temp(*temp).
|
|
int | Fin_Accel (float *x, float *y, float *z, int *tap, int *shake) |
| Fin_Accel(*x, *y, *z, *tap, *shake).
|
|
int | kbhit (void) |
|
Sets the API for use with Mac or Linux, comment out if using Windows.
#define Sleep |
( |
|
mm | ) |
usleep(mm*1000) |
If using Linux/Mac, redefines sleep to match that OS call.
int Fin_Accel |
( |
float * |
x, |
|
|
float * |
y, |
|
|
float * |
z, |
|
|
int * |
tap, |
|
|
int * |
shake |
|
) |
| |
Fin_Accel(*x, *y, *z, *tap, *shake).
Get acceleration values and tap/shaken flags. Returned acceleration values are in 'g' (in 1/1000 units) and range from +1.5 to -1.5g.
- Parameters
-
*x | pointer for the x-axis acceleration |
*z | pointer for the y-axis acceleration |
*y | pointer for the z-axis acceleration |
*tap | pointer to return the tap flag (0 = not tap) |
*shaken | pointer to return the shaken flag (0 = not shaken) |
- Returns
- -1 if failure
int Fin_Buzzer |
( |
int |
msec, |
|
|
int |
freq |
|
) |
| |
Fin_Buzzer(msec, freq).
Turn on the buzzer. Use 0,0 to turn the buzzer off
- Parameters
-
msec | duration in msecs |
freq | frequency in hz |
- Returns
- -1 if failure
Fin_Exit(void).
Sends Finch back to idle mode and closes the connection.
- Returns
- -1 if failure
Fin_init(void).
Initializes the interface to the finch robot and launches a background thread to prevent the finch from timing out. MUST be called prior to all other finch functions
- Returns
- -1 if failure
int Fin_LED |
( |
int |
red, |
|
|
int |
green, |
|
|
int |
blue |
|
) |
| |
Fin_LED(red, green, blue).
Set the color and intensity of the beak LED
- Parameters
-
red | intensity of the red portion of the beak LED (0-255, 0 is off) |
green | intensity of the green portion of the beak LED (0-255, 0 is off) |
blue | intensity of the blue portion of the beak LED (0-255, 0 is off) |
- Returns
- -1 if failure
int Fin_Lights |
( |
int * |
left, |
|
|
int * |
right |
|
) |
| |
Fin_Lights(*left, *right).
Get light sensor data. Returned values range from 255 to 0 (0=dark)
- Parameters
-
*left | pointer for left light sensor data |
*right | pointer for right light sensor data |
- Returns
- -1 if failure
int Fin_Motor |
( |
int |
tenth, |
|
|
int |
left, |
|
|
int |
right |
|
) |
| |
Fin_Motor(tenth, left, right).
Set the speed (and duration) of the wheels. Use 0,0,0 to stop. To set the wheels to spin continuously, set tenth to -1. This function does not block further program execution. Use Fin_Move for that.
- Parameters
-
tenth | motor on time (in tenths of a second) |
left | speed of left wheel (-255 to 255) |
right | speed of right wheel (-255 to 255) |
- Returns
- -1 if failure
int Fin_Move |
( |
int |
tenth, |
|
|
int |
left, |
|
|
int |
right |
|
) |
| |
Fin_Move(tenth, left, right).
Set the speed (and duration) of the wheels, and block the program from further execution until time is up. Useful for dancing programs.
- Parameters
-
tenth | motor on time (in tenths of a second) |
left | speed of left wheel (-255 to 255) |
right | speed of right wheel (-255 to 255) |
- Returns
- -1 if failure
int Fin_Obstacle |
( |
int * |
left, |
|
|
int * |
right |
|
) |
| |
Fin_Obstacle(*left, *right).
Get obstacle sensor data. Returned value is 1 or 0 (0=no obstacle).
- Parameters
-
*left | pointer for left obstacle sensor data |
*right | pointer for right obstacle sensor data |
- Returns
- -1 if failure
int Fin_Speed |
( |
int * |
left, |
|
|
int * |
right |
|
) |
| |
Fin_Speed(*left, *right).
Get the current speed of the wheels.
- Parameters
-
*left | pointer to return speed of left wheel |
*right | pointer to return speed of right wheel |
- Returns
- -1 if failure
int Fin_Temp |
( |
float * |
temp | ) |
|
Fin_Temp(*temp).
Get temperature sensor data
- Parameters
-
*temp | pointer to return the temperature; returned value is in celsius (in 1/1000 units) |
- Returns
- -1 if failure