Reference   Language | Libraries | Comparison | Changes

CurieIMU

readAccelerometer()

Description

Reads the raw value of the accelerometer.

Syntax

CurieIMU.readAccelerometer(int ax, int ay, int az)

Parameters

ax: a variable in which the accelerometer's value along x will be stored.
ay: a variable in which the accelerometer's value along y will be stored.
az: a variable in which the accelerometer's value along z will be stored.

To convert the raw value into mg use the following formula:
float g = (gRaw/32768.0)*getAccelerometerRange()
where gRaw is either ax, ay or az.

See also

Reference Home

Corrections, suggestions, and new documentation should be posted to the Forum.

The text of the Arduino reference is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.