Package edu.wpi.first.wpilibj
Class ADXL362
- java.lang.Object
-
- edu.wpi.first.wpilibj.ADXL362
-
- All Implemented Interfaces:
Accelerometer,Sendable,AutoCloseable
public class ADXL362 extends Object implements Accelerometer, Sendable, 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 classADXL362.AllAxesstatic classADXL362.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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()doublegetAcceleration(ADXL362.Axes axis)Get the acceleration of one axis in Gs.ADXL362.AllAxesgetAccelerations()Get the acceleration of all axes in Gs.doublegetX()Common interface for getting the x axis acceleration.doublegetY()Common interface for getting the y axis acceleration.doublegetZ()Common interface for getting the z axis acceleration.voidinitSendable(SendableBuilder builder)Initializes thisSendableobject.voidsetRange(Accelerometer.Range range)Common interface for setting the measuring range of an accelerometer.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface edu.wpi.first.wpilibj.Sendable
addChild, getName, getSubsystem, setName, setName, setName, setName, setSubsystem
-
-
-
-
Constructor Detail
-
ADXL362
public ADXL362(Accelerometer.Range range)
Constructor. Uses the onboard CS1.- Parameters:
range- The range (+ or -) that the accelerometer will measure.
-
ADXL362
public ADXL362(SPI.Port port, Accelerometer.Range range)
Constructor.- Parameters:
port- The SPI port that the accelerometer is connected torange- The range (+ or -) that the accelerometer will measure.
-
-
Method Detail
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable
-
setRange
public void setRange(Accelerometer.Range range)
Description copied from interface:AccelerometerCommon interface for setting the measuring range of an accelerometer.- Specified by:
setRangein interfaceAccelerometer- Parameters:
range- The maximum acceleration, positive or negative, that the accelerometer will measure. Not all accelerometers support all ranges.
-
getX
public double getX()
Description copied from interface:AccelerometerCommon interface for getting the x axis acceleration.- Specified by:
getXin interfaceAccelerometer- Returns:
- The acceleration along the x axis in g-forces
-
getY
public double getY()
Description copied from interface:AccelerometerCommon interface for getting the y axis acceleration.- Specified by:
getYin interfaceAccelerometer- Returns:
- The acceleration along the y axis in g-forces
-
getZ
public double getZ()
Description copied from interface:AccelerometerCommon interface for getting the z axis acceleration.- Specified by:
getZin interfaceAccelerometer- Returns:
- The acceleration along the z axis in g-forces
-
getAcceleration
public double getAcceleration(ADXL362.Axes axis)
Get the acceleration of one axis in Gs.- Parameters:
axis- The axis to read from.- Returns:
- Acceleration of the ADXL362 in Gs.
-
getAccelerations
public ADXL362.AllAxes 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
public void initSendable(SendableBuilder builder)
Description copied from interface:SendableInitializes thisSendableobject.- Specified by:
initSendablein interfaceSendable- Parameters:
builder- sendable builder
-
-