LSM303 Class
- ID: lsm303
- Name: Triaxial Accelerometer/magnetometer
- Other Names: Grove 6-Axis Accelerometer & Compass
- Category: accelerometer compass
- Manufacturer: seeed adafruit stmicro
- Link: http://www.seeedstudio.com/wiki/Grove_-_6-Axis_Accelerometer%26Compass
- Connection: i2c
This module defines the LSM303DLH 3-axis magnetometer/3-axis accelerometer. This module was tested with the Seeed Studio* Grove 6-Axis Accelerometer & Compass module used over I2C. The magnetometer and acceleromter are accessed at two seperate I2C addresses.
Item Index
Methods
LSM303
-
bus
-
addrMag
-
addrAcc
-
accScale
Instantiates an LSM303 object
Parameters:
-
bus
NumberI2C bus to use
-
addrMag
NumberI2C address of the Magnetometer (default 0x1E)
-
addrAcc
NumberI2C address of the Accelerometer (default 0x19)
-
accScale
NumberAccelerometer scale, can be 2, 4 or 8 (default 8)
Returns:
getHeading
()
Number
LSM303 object destructor where is no more need for this here - I2c connection will be stopped automatically when m_i2c variable will go out of scope ~LSM303 (); Gets the current heading; headings <0 indicate an error has occurred
Returns:
float
getCoordinates
()
Mraa::Result
Gets the coordinates in the XYZ order
Returns:
getAcceleration
()
Mraa::Result
Gets accelerometer values Should be called before other "get" functions for acceleration
Returns:
getRawCoorData
()
Int16Array
Gets raw coordinate data; it is updated when getCoordinates() is called
Returns:
getCoorX
()
Number
Gets the X component of the coordinates data
Returns:
getCoorY
()
Number
Gets the Y component of the coordinates data
Returns:
getCoorZ
()
Number
Gets the Z component of the coordinates data
Returns:
getRawAccelData
()
Int16Array
Gets raw accelerometer data; it is updated when getAcceleration() is called
Returns:
getAccelX
()
Number
Gets the X component of the acceleration data
Returns:
getAccelY
()
Number
Gets the Y component of the acceleration data
Returns:
getAccelZ
()
Number
Gets the Z component of the acceleration data