ADXL345_SPI

class wpilib.ADXL345_SPI(port: wpilib._wpilib.SPI.Port, range: wpilib.interfaces._interfaces.Accelerometer.Range = <Range.kRange_2G: 0>) → None

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

ADXL345 Accelerometer on SPI.

This class allows access to an Analog Devices ADXL345 3-axis accelerometer via SPI. This class assumes the sensor is wired in 4-wire SPI mode.

Constructor.

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

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

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

Bases: pybind11_builtins.pybind11_object

property XAxis
property YAxis
property ZAxis
class Axes(self: wpilib._wpilib.ADXL345_SPI.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_SPI, axis: wpilib._wpilib.ADXL345_SPI.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_SPI) → wpilib._wpilib.ADXL345_SPI.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_SPI) → float
getY(self: wpilib.ADXL345_SPI) → float
getZ(self: wpilib.ADXL345_SPI) → float
initSendable(self: wpilib.ADXL345_SPI, builder: wpilib.SendableBuilder) → None
setRange(self: wpilib.ADXL345_SPI, range: wpilib.interfaces._interfaces.Accelerometer.Range) → None