ADXL345_I2C

class wpilib.ADXL345_I2C(port: wpilib._wpilib.I2C.Port, range: wpilib.interfaces._interfaces.Accelerometer.Range = <Range.kRange_2G: 0>, deviceAddress: int = 29) → None

Bases: wpilib.ErrorBase, wpilib.interfaces.Accelerometer, wpilib.Sendable

ADXL345 Accelerometer on I2C.

This class allows access to a Analog Devices ADXL345 3-axis accelerometer on an I2C bus. This class assumes the default (not alternate) sensor address of 0x1D (7-bit address).

Constructs the ADXL345 Accelerometer over I2C.

Parameters
  • port – The I2C port the accelerometer is attached to

  • range – The range (+ or -) that the accelerometer will measure

  • deviceAddress – The I2C address of the accelerometer (0x1D or 0x53)

class AllAxes(self: wpilib._wpilib.ADXL345_I2C.AllAxes) → None

Bases: pybind11_builtins.pybind11_object

property XAxis
property YAxis
property ZAxis
class Axes(self: wpilib._wpilib.ADXL345_I2C.Axes, value: int) → None

Bases: pybind11_builtins.pybind11_object

Members:

kAxis_X

kAxis_Y

kAxis_Z

kAxis_X = <Axes.kAxis_X: 0>
kAxis_Y = <Axes.kAxis_Y: 2>
kAxis_Z = <Axes.kAxis_Z: 4>
property name
getAcceleration(self: wpilib.ADXL345_I2C, axis: wpilib._wpilib.ADXL345_I2C.Axes) → float

Get the acceleration of one axis in Gs.

Parameters

axis – The axis to read from.

Returns

Acceleration of the ADXL345 in Gs.

getAccelerations(self: wpilib.ADXL345_I2C) → wpilib._wpilib.ADXL345_I2C.AllAxes

Get the acceleration of all axes in Gs.

Returns

An object containing the acceleration measured on each axis of the ADXL345 in Gs.

getX(self: wpilib.ADXL345_I2C) → float
getY(self: wpilib.ADXL345_I2C) → float
getZ(self: wpilib.ADXL345_I2C) → float
initSendable(self: wpilib.ADXL345_I2C, builder: wpilib.SendableBuilder) → None
setRange(self: wpilib.ADXL345_I2C, range: wpilib.interfaces._interfaces.Accelerometer.Range) → None