# `Mob.Motion`
[🔗](https://github.com/genericjam/mob/blob/master/lib/mob/motion.ex#L1)

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`.

# `sensor`

```elixir
@type sensor() :: :accelerometer | :gyro
```

# `start`

```elixir
@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 (default `100`)

# `stop`

```elixir
@spec stop(Mob.Socket.t()) :: Mob.Socket.t()
```

Stop sensor updates.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
