Package edu.wpi.first.wpilibj
Class ADXL362
java.lang.Object
edu.wpi.first.wpilibj.ADXL362
- All Implemented Interfaces:
NTSendable
,Sendable
,AutoCloseable
public class ADXL362 extends Object implements NTSendable, AutoCloseable
ADXL362 SPI Accelerometer.
This class allows access to an Analog Devices ADXL362 3-axis accelerometer.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ADXL362.AllAxes
Container type for accelerations from all axes.static class
ADXL362.Axes
Accelerometer axes.static class
ADXL362.Range
Accelerometer range. -
Constructor Summary
Constructors Constructor Description ADXL362(ADXL362.Range range)
Constructor.ADXL362(SPI.Port port, ADXL362.Range range)
Constructor. -
Method Summary
Modifier and Type Method Description void
close()
double
getAcceleration(ADXL362.Axes axis)
Get the acceleration of one axis in Gs.ADXL362.AllAxes
getAccelerations()
Get the acceleration of all axes in Gs.int
getPort()
Returns the SPI port.double
getX()
Returns the acceleration along the X axis in g-forces.double
getY()
Returns the acceleration along the Y axis in g-forces.double
getZ()
Returns the acceleration along the Z axis in g-forces.void
initSendable(NTSendableBuilder builder)
Initializes thisSendable
object.void
setRange(ADXL362.Range range)
Set the measuring range of the accelerometer.
-
Constructor Details
-
Method Details
-
getPort
Returns the SPI port.- Returns:
- The SPI port.
-
close
- Specified by:
close
in interfaceAutoCloseable
-
setRange
Set the measuring range of the accelerometer.- Parameters:
range
- The maximum acceleration, positive or negative, that the accelerometer will measure.
-
getX
Returns the acceleration along the X axis in g-forces.- Returns:
- The acceleration along the X axis in g-forces.
-
getY
Returns the acceleration along the Y axis in g-forces.- Returns:
- The acceleration along the Y axis in g-forces.
-
getZ
Returns the acceleration along the Z axis in g-forces.- Returns:
- The acceleration along the Z axis in g-forces.
-
getAcceleration
Get the acceleration of one axis in Gs.- Parameters:
axis
- The axis to read from.- Returns:
- Acceleration of the ADXL362 in Gs.
-
getAccelerations
Get the acceleration of all axes in Gs.- Returns:
- An object containing the acceleration measured on each axis of the ADXL362 in Gs.
-
initSendable
Description copied from interface:NTSendable
Initializes thisSendable
object.- Specified by:
initSendable
in interfaceNTSendable
- Parameters:
builder
- sendable builder
-