Accelerometer and gyroscope sensor data.
No permission required.
Updates arrive at handle_info at the requested interval:
handle_info({:motion, %{
accel: {ax, ay, az}, # m/s² (gravity included)
gyro: {gx, gy, gz}, # rad/s
timestamp: unix_ms
}}, socket)If you only request one sensor, the other tuple will be {0.0, 0.0, 0.0}.
iOS: CMMotionManager. Android: SensorManager.
Summary
Types
Functions
@spec start( Mob.Socket.t(), keyword() ) :: Mob.Socket.t()
Start sensor updates.
Options:
sensors: [:accelerometer] | [:gyro] | [:accelerometer, :gyro](default both)interval_ms: integer— update interval in milliseconds (default100)
@spec stop(Mob.Socket.t()) :: Mob.Socket.t()
Stop sensor updates.