Accel

Python Library for NXP MMA8491Q 3-Axis Accelerometer & Tilt Sensor.

Python Library

Turta_Accel library is responsible for reading 3D acceleration and 3D tilt data from the MMA8491Q sensor.

Initialization

Add the following statement to the top of your Python code.

from turta_iothat3 import Turta_Accel

Then, create an instance of the AccelTiltSensor class.

accel = Turta_Accel.AccelTiltSensor()

Now you're ready to access the library by calling its instance.

Basic Members

Read Accel X

Reads the G force of X-axis.

read_accel_x()
  • Parameters

    • None

  • Returns

    • Int: G force of X-axis.

Read Accel Y

Reads the G force of Y-axis.

read_accel_y()
  • Parameters

    • None

  • Returns

    • Int: G force of Y-axis.

Read Accel Z

Reads the G force of Z-axis.

read_accel_z()
  • Parameters

    • None

  • Returns

    • Int: G force of Z-axis.

Read Accel XYZ

Reads the G forces of X, Y and Z-axes.

read_accel_xyz()
  • Parameters

    • None

  • Returns

    • Int[]: G forces of X, Y and Z-axes respectively

Read Tilt X

Reads the X-Axis tilt state.

read_tilt_x()
  • Parameters

    • None

  • Returns

    • Bool: True if acceleration is > 0.688g or X-axis > 45, false if not.

Read Tilt Y

Reads the Y-Axis tilt state.

read_tilt_y()
  • Parameters

    • None

  • Returns

    • Bool: True if acceleration is > 0.688g or X-axis > 45, false if not.

Read Tilt Z

Reads the Z-Axis tilt state.

read_tilt_z()
  • Parameters

    • None

  • Returns

    • Bool: True if acceleration is > 0.688g or X-axis > 45, false if not.

Read Tilt XYZ

Reads the X, Y and Z-Axis tilt states respectively.

read_tilt_xyz()
  • Parameters

    • None

  • Returns

    • Bool[]: True if acceleration is > 0.688g or axis > 45, false if not.

Finalizer

When exiting from the program, the library releases the GPIO pins.

Last updated