Linear Accelerometer model element

LinearAccelerometer provides access to the built-in sensor for acceleration force along the x,y,z axes (excluding gravity).

Usage

To add the LinearAccelerometer element to your model, drag the icon element to the list of your model elements.

The element implements the following basic methods:

Example of use

linearAccelerometer.start(); // Starts the accelerometer
var data = linearAccelerometer.readData(); // Reads the current linear acceleration 
_println("The acceleration on the X component is " + data.x);
_println("The acceleration on the Y component is " + data.y);
_println("The acceleration on the Z component is " + data.z);
linearAccelerometer.stop(); // Stops the accelerometer