Accel
Python Library for NXP MMA8491Q 3-Axis Accelerometer & Tilt Sensor.
Turta_Accel library is responsible for reading 3D acceleration and 3D tilt data from the MMA8491Q sensor.
Add the following statement to the top of your Python code.
from turta_sensoruhat 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.
Reads the G force of X-axis.
read_accel_x()
Parameters
None Returns
Int: G force of X-axis.
Reads the G force of Y-axis.
read_accel_y()
Parameters
None Returns
Int: G force of Y-axis.
Reads the G force of Z-axis.
read_accel_z()
Parameters
None Returns
Int: G force of Z-axis.
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
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.
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.
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.
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.
When exiting from the program, the library releases the GPIO pins.
Last modified 2yr ago