system.setAccelerometerInterval()

Type Function
Library system.*
Return value none
Revision Current Public Release (2014.2189)
Keywords accelerometer
See also accelerometer

Overview

Sets the frequency of accelerometer events. On the iPhone, the minimum frequency is 10 Hz and the maximum is 100 Hz. Accelerometer events are a significant drain on battery, so only increase the frequency when you need faster responses.

Gotchas

Battery Life

If possible, lower the frequency to conserve battery life.

iOS

On iOS devices, these are the frequency limits:

  • Maximum value: 100 Hz
  • Minimum value: 10 Hz

Default values

On iOS, the default is not documented. Based on past observations, the frequency default is typically low, e.g. 10 Hz.

On Android, the default is about 10 Hz (exact timing is definitely not guaranteed).

To be safe, you should set this yourself.

Syntax

system.setAccelerometerInterval( frequency )

Examples

-- Set the measurement interval to 50 Hz.
-- This makes the system take 50 measurements per second.
system.setAccelerometerInterval( 50 )