Accelerometer

Measure linear acceleration along X, Y, and Z axes

Library

Simulink Support Package for Android Devices / Sensors

Description

Get the measurement of acceleration in m/s2 in the X, Y, and Z directions from the accelerometer on the Android™ device.

The Accelerometer block has three outputs: X, Y, and Z. Each port outputs a single-precision scalar value.

The following illustration shows the X, Y, and Z orientation axes relative to a typical Android mobile phone.

The following illustration shows the X, Y, and Z orientation axes relative to a typical Android tablet.

The X, Y, and Z orientation axes relative to the device remain constant. For example, if you place the device face-up on a table, the Z-axis measures the acceleration of Earth gravity and outputs ≈9.81 in m/s2. The X and Y axes, which are perpendicular to the acceleration of Earth gravity, both output ≈0.00 in m/s2.

Note

During simulations without hardware, this block outputs zeros. See Block Produces Zeros or Does Nothing in Simulation (Simulink).

Parameters

Sample time

Specify how often the block reads the sensor.

Smaller values require the processor to complete the same number of instructions in less time, which can cause task overruns.

Introduced in R2014a