pyupm_mma7361 module¶
-
class
pyupm_mma7361.
MMA7361
(x_pin, y_pin, z_pin, selftest_pin, sleep_pin, freefall_pin, range_pin, a_ref=5.0)[source]¶ Bases:
object
API for the DFRobot MMA7361 Analog Accelerometer.
ID: mma7361
Name: Triaxial Analog Accelerometer
Category: accelerometer
Manufacturer: dfrobot
Connection: analog gpio
Link:http://www.dfrobot.com/index.php?route=product/product&path=36&product_id=507#.V7YEj99ytNJ This library was tested with the DFRobot MMA7361 Analog Accelerometer. It supports 3 Axes with a selectable 1.5G and 6G sensitivity.
C++ includes: mma7361.hpp
-
enableSelftest
(enable)[source]¶ void enableSelftest(bool enable)
Enable self test mode.
enable: true to enable the self test mode, false otherwise.
-
getAcceleration
(*args)[source]¶ float * getAcceleration()
Get computed acceleration from the sensor. update() must have been called prior to calling this function.
a pointer to a statically allocated array of 3 floats containing the X, Y, and Z componenets.
-
getNormalized
(*args)[source]¶ float * getNormalized()
Get the normalized ADC values from the sensor. update() must have been called prior to calling this function.
a pointer to a statically allocated array of 3 ints containing the X, Y, and Z componenets.
-
getVolts
(*args)[source]¶ float * getVolts()
Get the measured volts from the sensor. update() must have been called prior to calling this function.
a pointer to a statically allocated array of 3 floats containing the X, Y, and Z componenets.
-
isInFreefall
()[source]¶ bool isInFreefall()
Get freefall detection status.
true if a freefall condition is detected, false otherwise.
-
setOffset
(x, y, z)[source]¶ void setOffset(float x, float y, float z)
Set sensor offset. This offset is applied to the return values before scaling. Default is 0.0.
x: Offset to apply to X value
y: Offset to apply to Y value
z: Offset to apply to Z value
-
setRange
(range)[source]¶ void setRange(bool range)
Set the range of the device. This device supports two G ranges: 1.5 and 6. The default is 1.5G.
range: true for 6G, false for 1.5G
-
setScale
(x, y, z)[source]¶ void setScale(float x, float y, float z)
Set sensor scale. The acceleration return values are scaled by this value before the offset is applied. Default is 1.0.
x: Scale to apply to X value
y: Scale to apply to Y value
z: Scale to apply to Z value
-