ADXL345_I2C(I2C::Port port, int range=2, int deviceAddress=DEFAULT_ADDRESS)
Constructs the ADXL345 Accelerometer over I2C.
void SetRange(int range)
Set the measuring range of the accelerometer.
virtual AllAxes GetAccelerations()
Get the acceleration of all axes in Gs.
int GetI2CDeviceAddress() const
static constexpr int DEFAULT_ADDRESS
Default I2C device address.
Definition ADXL345_I2C.hpp:49
double GetY()
Returns the acceleration along the Y axis in g-forces.
ADXL345_I2C & operator=(ADXL345_I2C &&)=default
I2C::Port GetI2CPort() const
Axis
Accelerometer axes.
Definition ADXL345_I2C.hpp:27
@ X
X axis.
Definition ADXL345_I2C.hpp:29
@ Z
Z axis.
Definition ADXL345_I2C.hpp:33
@ Y
Y axis.
Definition ADXL345_I2C.hpp:31
virtual double GetAcceleration(Axis axis)
Get the acceleration of one axis in Gs.
void InitSendable(wpi::nt::NTSendableBuilder &builder) override
Initializes this Sendable object.
~ADXL345_I2C() override=default
ADXL345_I2C(ADXL345_I2C &&)=default
double GetZ()
Returns the acceleration along the Z axis in g-forces.
double GetX()
Returns the acceleration along the X axis in g-forces.
I2C bus interface class.
Definition I2C.hpp:21
Port
I2C connection ports.
Definition I2C.hpp:26
A move-only C++ wrapper around a HAL simulator device handle.
Definition SimDevice.hpp:278
C++ wrapper around a HAL simulator double value handle.
Definition SimDevice.hpp:169
C++ wrapper around a HAL simulator enum value handle.
Definition SimDevice.hpp:210
Helper class for building Sendable dashboard representations for NetworkTables.
Definition NTSendableBuilder.hpp:21
Interface for NetworkTable Sendable objects.
Definition NTSendable.hpp:16
A helper class for use with objects that add themselves to SendableRegistry.
Definition SendableHelper.hpp:21
Definition CvSource.hpp:15
Container type for accelerations from all axes.
Definition ADXL345_I2C.hpp:39
double x
Acceleration along the X axis in g-forces.
Definition ADXL345_I2C.hpp:41
double z
Acceleration along the Z axis in g-forces.
Definition ADXL345_I2C.hpp:45
double y
Acceleration along the Y axis in g-forces.
Definition ADXL345_I2C.hpp:43