ADXL345_I2C¶
-
class
wpilib.
ADXL345_I2C
(port, range, address=None)[source]¶ Bases:
wpilib.SensorBase
ADXL345 accelerometer device via i2c
Constructor.
Parameters: - port (
I2C.Port
) – The I2C port the accelerometer is attached to. - range (
ADXL345_I2C.Range
) – The range (+ or -) that the accelerometer will measure. - address – the I2C address of the accelerometer (0x1D or 0x53)
-
ADXL345_I2C.
getAcceleration
(axis)[source]¶ Get the acceleration of one axis in Gs.
Parameters: axis – The axis to read from. Returns: An object containing the acceleration measured on each axis of the ADXL345 in Gs.
-
ADXL345_I2C.
getAccelerations
()[source]¶ Get the acceleration of all axes in Gs.
Returns: X,Y,Z tuple of acceleration measured on all axes of the ADXL345 in Gs.
-
ADXL345_I2C.
getX
()[source]¶ Get the x axis acceleration
Returns: The acceleration along the x axis in g-forces
-
ADXL345_I2C.
getY
()[source]¶ Get the y axis acceleration
Returns: The acceleration along the y axis in g-forces
-
ADXL345_I2C.
getZ
()[source]¶ Get the z axis acceleration
Returns: The acceleration along the z axis in g-forces
-
ADXL345_I2C.
kAddress
= 29¶
-
ADXL345_I2C.
kDataFormatRegister
= 49¶
-
ADXL345_I2C.
kDataFormat_FullRes
= 8¶
-
ADXL345_I2C.
kDataFormat_IntInvert
= 32¶
-
ADXL345_I2C.
kDataFormat_Justify
= 4¶
-
ADXL345_I2C.
kDataFormat_SPI
= 64¶
-
ADXL345_I2C.
kDataFormat_SelfTest
= 128¶
-
ADXL345_I2C.
kDataRegister
= 50¶
-
ADXL345_I2C.
kGsPerLSB
= 0.00390625¶
-
ADXL345_I2C.
kPowerCtlRegister
= 45¶
-
ADXL345_I2C.
kPowerCtl_AutoSleep
= 16¶
-
ADXL345_I2C.
kPowerCtl_Link
= 32¶
-
ADXL345_I2C.
kPowerCtl_Measure
= 8¶
-
ADXL345_I2C.
kPowerCtl_Sleep
= 4¶
-
ADXL345_I2C.
setRange
(range)[source]¶ Set the measuring range of the accelerometer.
Parameters: range ( ADXL345_I2C.Range
) – The maximum acceleration, positive or negative, that the accelerometer will measure.
- port (