MMA7361 Class
- 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.
Item Index
Methods
MMA7361
-
x_pin
-
y_pin
-
z_pin
-
selftest_pin
-
sleep_pin
-
freefall_pin
-
range_pin
-
a_ref
MMA7361 object constructor
Parameters:
-
x_pin
NumberAnalog pin to use for X axis. -1 to disable.
-
y_pin
NumberAnalog pin to use for Y axis. -1 to disable.
-
z_pin
NumberAnalog pin to use for Z axis. -1 to disable.
-
selftest_pin
NumberGPIO pin to use for self test. -1 to disable.
-
sleep_pin
NumberGPIO pin to use for sleep function. -1 to disable.
-
freefall_pin
NumberGPIO pin to use for free fall (0g) detection. -1 to disable.
-
range_pin
NumberGPIO pin to select range (1.5g or 6g). -1 to disable.
-
a_ref
NumberThe analog reference voltage in use. Default 5.0.
Returns:
setRange
-
range
Set the range of the device. This device supports two G ranges: 1.5 and 6. The default is 1.5G.
Parameters:
-
range
Booleantrue for 6G, false for 1.5G
setSleep
-
sleep
Set sleep mode. When in sleep mode the sensor uses minimal power.
Parameters:
-
sleep
Booleantrue to go into sleep mode, false to wake up
isInFreefall
()
Boolean
Get freefall detection status.
Returns:
true if a freefall condition is detected, false otherwise.
enableSelftest
-
enable
Enable self test mode.
Parameters:
-
enable
Booleantrue to enable the self test mode, false otherwise.
update
()
Read the sensor status an update internal state. update() must have been called before calling getAcceleration() , getNormalized() , or getVolts() .
setOffset
-
x
-
y
-
z
Set sensor offset. This offset is applied to the return values before scaling. Default is 0.0.
Parameters:
-
x
NumberOffset to apply to X value
-
y
NumberOffset to apply to Y value
-
z
NumberOffset to apply to Z value
setScale
-
x
-
y
-
z
Set sensor scale. The acceleration return values are scaled by this value before the offset is applied. Default is 1.0.
Parameters:
-
x
NumberScale to apply to X value
-
y
NumberScale to apply to Y value
-
z
NumberScale to apply to Z value
getAcceleration
-
x
-
y
-
z
Get computed acceleration from the sensor. update() must have been called prior to calling this function.
Parameters:
-
x
Float *a pointer in which X acceleration data will be returned
-
y
Float *a pointer in which Y acceleration data will be returned
-
z
Float *a pointer in which Z acceleration data will be returned
getAcceleration
()
Float *
Get computed acceleration from the sensor. update() must have been called prior to calling this function.
Returns:
a pointer to a statically allocated array of 3 floats containing the X, Y, and Z componenets.
getVolts
-
x
-
y
-
z
Get the measured volts from the sensor. update() must have been called prior to calling this function.
Parameters:
-
x
Float *a pointer in which X volt data will be returned
-
y
Float *a pointer in which Y volt data will be returned
-
z
Float *a pointer in which Z volt data will be returned
getVolts
()
Float *
Get the measured volts from the sensor. update() must have been called prior to calling this function.
Returns:
a pointer to a statically allocated array of 3 floats containing the X, Y, and Z componenets.
getNormalized
-
x
-
y
-
z
Get the normalized ADC values from the sensor. update() must have been called prior to calling this function.
Parameters:
-
x
Float *a pointer in which X normalized ADC data will be returned
-
y
Float *a pointer in which Y normalized ADC data will be returned
-
z
Float *a pointer in which Z normalized ADC data will be returned
getNormalized
()
Float *
Get the normalized ADC values from the sensor. update() must have been called prior to calling this function.
Returns:
a pointer to a statically allocated array of 3 ints containing the X, Y, and Z componenets.