Accelerometer

class wpilib.interfaces.Accelerometer[source]

Bases: object

Interface for 3-axis accelerometers

class Range[source]

Bases: object

k16G = 3
k2G = 0
k4G = 1
k8G = 2
Accelerometer.getX()[source]

Common interface for getting the x axis acceleration

Returns:The acceleration along the x axis in g-forces
Accelerometer.getY()[source]

Common interface for getting the y axis acceleration

Returns:The acceleration along the y axis in g-forces
Accelerometer.getZ()[source]

Common interface for getting the z axis acceleration

Returns:The acceleration along the z axis in g-forces
Accelerometer.setRange(range)[source]

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.