motion — Motion Sensor Data on iOS#

The motion module allows you to access your iOS device’s motion sensor data (accelerometer, gyroscope, magnetometer).

Functions in the motion module:


Start monitoring the device’s motion sensors. You should balance this with a stop_updates() call to improve battery life. All the get… functions require that you call start_updates() first, otherwise, no meaningful data will be returned.


Stop monitoring the device’s motion sensors.


Return the gravity vector (x, y, z).


Return the acceleration the user is giving to the device. The total acceleration is equal to the gravity vector returned from get_gravity() plus the user acceleration.


Return the attitude of the device (roll, pitch, yaw).


Return the magnetic field vector with respect to the device (x, y, z, accuracy).