ADXL362

class wpilib.ADXL362(range, port=None)[source]

Bases: wpilib.SensorBase

ADXL362 SPI Accelerometer.

This class allows access to an Analog Devices ADXL362 3-axis accelerometer.

Constructor.

Parameters:
  • range (ADXL362.Range) – The range (+ or -) that the accelerometer will measure.
  • port (SPI.Port) – The SPI port that the accelerometer is connected to
class Axes[source]

Bases: object

kX = 0
kY = 2
kZ = 4
class ADXL362.Range

Bases: object

k16G = 3
k2G = 0
k4G = 1
k8G = 2
ADXL362.free()[source]
ADXL362.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 in Gs.
ADXL362.getAccelerations()[source]

Get the acceleration of all axes in Gs.

Returns:X,Y,Z tuple of acceleration measured on all axes in Gs.
ADXL362.getX()[source]

Get the x axis acceleration

Returns:The acceleration along the x axis in g-forces
ADXL362.getY()[source]

Get the y axis acceleration

Returns:The acceleration along the y axis in g-forces
ADXL362.getZ()[source]

Get the z axis acceleration

Returns:The acceleration along the z axis in g-forces
ADXL362.kDataRegister = 14
ADXL362.kFilterCtlRegister = 44
ADXL362.kFilterCtl_ODR_100Hz = 3
ADXL362.kFilterCtl_Range2G = 0
ADXL362.kFilterCtl_Range4G = 64
ADXL362.kFilterCtl_Range8G = 128
ADXL362.kPartIdRegister = 2
ADXL362.kPowerCtlRegister = 45
ADXL362.kPowerCtl_AutoSleep = 4
ADXL362.kPowerCtl_Measure = 2
ADXL362.kPowerCtl_UltraLowNoise = 32
ADXL362.kRegRead = 11
ADXL362.kRegWrite = 10
ADXL362.setRange(range)[source]

Set the measuring range of the accelerometer.

Parameters:range (ADXL362.Range) – The maximum acceleration, positive or negative, that the accelerometer will measure.