Accelerometer modes

There are seven work modes for the accelerometer:

  • On

  • Power Down

  • Low power 1

  • Low power 2

  • Low power 3

  • Low power 4

  • Low power 5

To change between these modes, there are two functions that have been developed.

Setting accelerometer mode

It sets the accelerometer's work mode. It configures the accelerometer to a new work mode, where the possibilities are:

  • ACC_ON Normal mode: Output data rate 50 Hz

  • ACC_POWER_DOWN Turn power off

  • ACC_LOW_POWER_1 Low power mode: Output data rate 0.5 Hz

  • ACC_LOW_POWER_2 Low power mode: Output data rate 1 Hz

  • ACC_LOW_POWER_3 Low power mode: Output data rate 2 Hz

  • ACC_LOW_POWER_4 Low power mode: Output data rate 5 Hz

  • ACC_LOW_POWER_5 Low power mode: Output data rate 10 Hz

Since it calls writeRegister(), it will not activate any flags by itself, but the other functions will activate ACC_ERROR_READING in case there was an error communicating to the register.

Example of use:

{
ACC.setMode(ACC_LOW_POWER_2);
}

Related variable:

accMode → stores the work mode

Getting accelerometer mode

It checks accelerometer's work mode.

It returns the value for the accelerometer's work mode, the possibilities are:

  • ACC_ON Normal mode: Output data rate 50 Hz

  • ACC_POWER_DOWN Turn power off

  • ACC_LOW_POWER_1 Low power mode: Output data rate 0.5 Hz

  • ACC_LOW_POWER_2 Low power mode: Output data rate 1 Hz

  • ACC_LOW_POWER_3 Low power mode: Output data rate 2 Hz

  • ACC_LOW_POWER_4 Low power mode: Output data rate 5 Hz

  • ACC_LOW_POWER_5 Low power mode: Output data rate 10 Hz

It does not call any other functions and therefore it will not activate any flags.

Example of use:

{
uint8_t workMode;
workMode = ACC.getMode();
}

Last updated