upm  0.4.1
Sensor/Actuator repository for libmraa (v0.8.0)
Public Member Functions | List of all members

API for the ITG-3200 3-Axis Digital Gyroscope. More...

Detailed Description

InvenSense* ITG-3200 is a 3-axis digital gyroscope. (https://www.sparkfun.com/datasheets/Sensors/Gyro/PS-ITG-3200-00-01.4.pdf) This sensor has been tested and can run at either 3.3V or 5V on Intel(R) Galileo.
However, it is incompatible with and not detected on the I2C bus by Intel(R) Edison using the Arduino* breakout board.

itg3200.jpeg
short[] rot;
float[] ang;
// Note: Sensor not supported on Intel Edison with Arduino breakout
while (true) {
gyro.update();
rot = gyro.getRawValues();
ang = gyro.getRotation();
System.out.println("Raw Values: X: " + rot[0] + " Y: " + rot[1] + " Z: " + rot[2]);
System.out.println("Angular Velocities: X: " + ang[0] + " Y: " + ang[1] + " Z: "
+ ang[2]);
System.out.println("Temp: " + gyro.getTemperature() + ", Raw: " + gyro.getRawTemp());
Thread.sleep(1000);
}

Public Member Functions

synchronized void delete ()
 
 Itg3200 (int bus)
 
void calibrate ()
 
float getTemperature ()
 
float[] getRotation ()
 
short[] getRawValues ()
 
short getRawTemp ()
 
int update ()
 

Constructor & Destructor Documentation

Itg3200 ( int  bus)

Creates an Itg3200 object

Parameters
busNumber of the used I2C bus

Member Function Documentation

void calibrate ( )

Calibrates the sensor to 0 on all axes. The sensor needs to be resting for accurate calibration. It takes about 3 seconds and is also called by the constructor on object creation.

short getRawTemp ( )

Returns an int that contains the raw register value for the temperature

Returns
int Raw temperature
short [] getRawValues ( )

Returns a pointer to an int[3] that contains raw register values for X, Y, and Z

Returns
int* to an int[3]
float [] getRotation ( )

Returns a pointer to a float[3] that contains computed rotational speeds (angular velocities)

Returns
float* to a float[3]
float getTemperature ( )

Returns the temperature reading, in Celsius, from the integrated temperature sensor

Returns
float Temperature in Celsius
int update ( )

Updates the rotational values and temperature by reading from the I2C bus

Returns
0 if successful

The documentation for this class was generated from the following file: