Package edu.wpi.first.wpilibj
Class ADXL362
java.lang.Object
edu.wpi.first.wpilibj.ADXL362
- All Implemented Interfaces:
NTSendable
,Sendable
,Accelerometer
,AutoCloseable
public class ADXL362 extends Object implements Accelerometer, 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
static class
ADXL362.Axes
Nested classes/interfaces inherited from interface edu.wpi.first.wpilibj.interfaces.Accelerometer
Accelerometer.Range
-
Constructor Summary
Constructors Constructor Description ADXL362(Accelerometer.Range range)
Constructor.ADXL362(SPI.Port port, Accelerometer.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()
double
getX()
Common interface for getting the x-axis acceleration.double
getY()
Common interface for getting the y-axis acceleration.double
getZ()
Common interface for getting the z axis acceleration.void
initSendable(NTSendableBuilder builder)
Initializes thisSendable
object.void
setRange(Accelerometer.Range range)
Common interface for setting the measuring range of an accelerometer.
-
Constructor Details
-
Method Details
-
getPort
-
close
- Specified by:
close
in interfaceAutoCloseable
-
setRange
Description copied from interface:Accelerometer
Common interface for setting the measuring range of an accelerometer.- Specified by:
setRange
in interfaceAccelerometer
- Parameters:
range
- The maximum acceleration, positive or negative, that the accelerometer will measure. Not all accelerometers support all ranges.
-
getX
Description copied from interface:Accelerometer
Common interface for getting the x-axis acceleration.- Specified by:
getX
in interfaceAccelerometer
- Returns:
- The acceleration along the x-axis in g-forces
-
getY
Description copied from interface:Accelerometer
Common interface for getting the y-axis acceleration.- Specified by:
getY
in interfaceAccelerometer
- Returns:
- The acceleration along the y-axis in g-forces
-
getZ
Description copied from interface:Accelerometer
Common interface for getting the z axis acceleration.- Specified by:
getZ
in interfaceAccelerometer
- 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
-