WPILibC++ 2024.3.2
Accelerometer Functions

Enumerations

enum  HAL_AccelerometerRange : int32_t { HAL_AccelerometerRange_k2G = 0 , HAL_AccelerometerRange_k4G = 1 , HAL_AccelerometerRange_k8G = 2 }
 The acceptable accelerometer ranges. More...
 

Functions

void HAL_SetAccelerometerActive (HAL_Bool active)
 Sets the accelerometer to active or standby mode. More...
 
void HAL_SetAccelerometerRange (HAL_AccelerometerRange range)
 Sets the range of values that can be measured (either 2, 4, or 8 g-forces). More...
 
double HAL_GetAccelerometerX (void)
 Gets the x-axis acceleration. More...
 
double HAL_GetAccelerometerY (void)
 Gets the y-axis acceleration. More...
 
double HAL_GetAccelerometerZ (void)
 Gets the z-axis acceleration. More...
 

Detailed Description

Enumeration Type Documentation

◆ HAL_AccelerometerRange

enum HAL_AccelerometerRange : int32_t

The acceptable accelerometer ranges.

Enumerator
HAL_AccelerometerRange_k2G 
HAL_AccelerometerRange_k4G 
HAL_AccelerometerRange_k8G 

Function Documentation

◆ HAL_GetAccelerometerX()

double HAL_GetAccelerometerX ( void  )

Gets the x-axis acceleration.

This is a floating point value in units of 1 g-force.

Returns
the X acceleration

◆ HAL_GetAccelerometerY()

double HAL_GetAccelerometerY ( void  )

Gets the y-axis acceleration.

This is a floating point value in units of 1 g-force.

Returns
the Y acceleration

◆ HAL_GetAccelerometerZ()

double HAL_GetAccelerometerZ ( void  )

Gets the z-axis acceleration.

This is a floating point value in units of 1 g-force.

Returns
the Z acceleration

◆ HAL_SetAccelerometerActive()

void HAL_SetAccelerometerActive ( HAL_Bool  active)

Sets the accelerometer to active or standby mode.

It must be in standby mode to change any configuration.

Parameters
activetrue to set to active, false for standby

◆ HAL_SetAccelerometerRange()

void HAL_SetAccelerometerRange ( HAL_AccelerometerRange  range)

Sets the range of values that can be measured (either 2, 4, or 8 g-forces).

The accelerometer should be in standby mode when this is called.

Parameters
rangethe accelerometer range