upm  0.5.1
Sensor/Actuator repository for libmraa (v0.9.1)
 All Data Structures Files Functions Variables Enumerations Enumerator Macros Groups Pages
Public Member Functions
Itg3200 Class Reference

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
int16_t *rot;
float *ang;
// Note: Sensor not supported on Intel Edison with Arduino breakout
upm::Itg3200* gyro = new upm::Itg3200(0);
while(true){
gyro->update(); // Update the data
rot = gyro->getRawValues(); // Read raw sensor data
ang = gyro->getRotation(); // Read rotational speed (deg/sec)
fprintf(stdout, "Raw: %6d %6d %6d\n", rot[0], rot[1], rot[2]);
fprintf(stdout, "AngX: %5.2f\n", ang[0]);
fprintf(stdout, "AngY: %5.2f\n", ang[1]);
fprintf(stdout, "AngZ: %5.2f\n", ang[2]);
fprintf(stdout, "Temp: %5.2f Raw: %6d\n", gyro->getTemperature(), gyro->getRawTemp());
sleep(1);
}

Public Member Functions

 Itg3200 (int bus)
 
void calibrate ()
 
float getTemperature ()
 
float * getRotation ()
 
int16_t * getRawValues ()
 
int16_t getRawTemp ()
 
mraa::Result update ()
 

Constructor & Destructor Documentation

Itg3200 ( int  bus)

Creates an Itg3200 object

Parameters
busNumber of the used I2C bus

Here is the call graph for this function:

Member Function Documentation

void calibrate ( void  )

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.

Here is the call graph for this function:

Here is the caller graph for this function:

float getTemperature ( void  )

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

Returns
float Temperature in Celsius
float * getRotation ( void  )

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

Returns
float* to a float[3]
int16_t * getRawValues ( )

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

Returns
int* to an int[3]
int16_t getRawTemp ( )

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

Returns
int Raw temperature
mraa::Result update ( void  )

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

Returns
0 if successful

Here is the caller graph for this function:


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