# Accelerometer

## Getting Started&#x20;

The accelerometer sensor is used to measure the force of acceleration acting on the phone. The sensor reports this force for each of the three principal axes, the x axis, y axis and, the z axis. The values obtained from the sensor are in metres per second squared, $$m/s^2$$.<br>

![The x, y and z axes of a standard smartphone](/files/-LfAKq11ubZzw9kwMlpm)

## Blocks

### Events

#### Shaking

There may be some instances where you want to start an event by shaking your mobile device or when the mobile device is shook. There is a `Shaking` event that you can add to your blocks that has sensitivity levels of `high`, `medium` and `low`

![](/files/-Lh1LjC3OuaypGyXXWQ4)

#### Changes

When the accelerometer sensor detects a change in the force acting on the phone the `Changes` event will be fired. Each time the event fires the four associated parameters will be updated.

![](/files/-LfA4bXEe8dgrCQVB63V)

| **Parameter**   | Type   | Returns                                                      |
| --------------- | ------ | ------------------------------------------------------------ |
| `xAcceleration` | Number | Change in speed of the phone, along the x axis, in $$m/s^2$$ |
| `yAcceleration` | Number | Change in speed of the phone, along the y axis, in $$m/s^2$$ |
| `zAcceleration` | Number | Change in speed of the phone, along the z axis, in $$m/s^2$$ |
| `error`         | String | Error message from sensor                                    |

### Functions

#### Get Acceleration on X, Y, Z axes

You can get the values for xAcceleration, yAcceleration and zAcceleration at any time with the following blocks.

![](/files/-MJXH_LCTx4ICLcvg4oZ)

### Properties

#### Enabled

By default the accelerometer sensor will be turned on, but you can use the `Enabled` property to read its current state and to change its state, i.e turn the sensor on and off.

![](/files/-MXHQ3QBElO_EEIqeO1N)

| Property      | Type | Default |
| ------------- | ---- | ------- |
| `set Enabled` | Bool | True    |
| `get Enabled` | Bool |         |

#### Sensitivity

You can use the Sensitivity blocks to set the sensitivity of the Accelerometer and get its current level of sensitivity.

![](/files/-MJXHlXhUzJKBGrESLeB)

| Property          | Type                        | Default |
| ----------------- | --------------------------- | ------- |
| `set Sensitivity` | one of \[low, medium, high] | low     |
| `get Sensitivity` | one of \[low, medium, high] |         |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.thunkable.com/snap-to-place/accelerometer.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
