Package edu.wpi.first.wpilibj
Class ADXL362
java.lang.Object
edu.wpi.first.wpilibj.ADXL362
- All Implemented Interfaces:
NTSendable,Sendable,AutoCloseable
ADXL362 SPI Accelerometer.
This class allows access to an Analog Devices ADXL362 3-axis accelerometer.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classContainer type for accelerations from all axes.static enumAccelerometer axes.static enumAccelerometer range. -
Constructor Summary
ConstructorsConstructorDescriptionADXL362(ADXL362.Range range) Constructor.ADXL362(SPI.Port port, ADXL362.Range range) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()doublegetAcceleration(ADXL362.Axes axis) Get the acceleration of one axis in Gs.Get the acceleration of all axes in Gs.intgetPort()Returns the SPI port.doublegetX()Returns the acceleration along the X axis in g-forces.doublegetY()Returns the acceleration along the Y axis in g-forces.doublegetZ()Returns the acceleration along the Z axis in g-forces.voidinitSendable(NTSendableBuilder builder) Initializes thisSendableobject.final voidsetRange(ADXL362.Range range) Set the measuring range of the accelerometer.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface edu.wpi.first.networktables.NTSendable
initSendable
-
Constructor Details
-
ADXL362
Constructor. Uses the onboard CS1.- Parameters:
range- The range (+ or -) that the accelerometer will measure.
-
ADXL362
Constructor.- Parameters:
port- The SPI port that the accelerometer is connected torange- The range (+ or -) that the accelerometer will measure.
-
-
Method Details
-
getPort
Returns the SPI port.- Returns:
- The SPI port.
-
close
- Specified by:
closein 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:NTSendableInitializes thisSendableobject.- Specified by:
initSendablein interfaceNTSendable- Parameters:
builder- sendable builder
-