Interface Accelerometer

All Known Implementing Classes:
ADXL345_I2C, ADXL345_SPI, ADXL362, BuiltInAccelerometer

public interface Accelerometer
Interface for 3-axis accelerometers.
  • Nested Class Summary

    Nested Classes 
    Modifier and Type Interface Description
    static class  Accelerometer.Range  
  • Method Summary

    Modifier and Type Method Description
    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 setRange​(Accelerometer.Range range)
    Common interface for setting the measuring range of an accelerometer.
  • Method Details

    • setRange

      void setRange​(Accelerometer.Range range)
      Common interface for setting the measuring range of an accelerometer.
      Parameters:
      range - The maximum acceleration, positive or negative, that the accelerometer will measure. Not all accelerometers support all ranges.
    • getX

      double getX()
      Common interface for getting the x-axis acceleration.
      Returns:
      The acceleration along the x-axis in g-forces
    • getY

      double getY()
      Common interface for getting the y-axis acceleration.
      Returns:
      The acceleration along the y-axis in g-forces
    • getZ

      double getZ()
      Common interface for getting the z axis acceleration.
      Returns:
      The acceleration along the z axis in g-forces