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_pinNumberAnalog pin to use for X axis. -1 to disable. 
- 
                                              y_pinNumberAnalog pin to use for Y axis. -1 to disable. 
- 
                                              z_pinNumberAnalog pin to use for Z axis. -1 to disable. 
- 
                                              selftest_pinNumberGPIO pin to use for self test. -1 to disable. 
- 
                                              sleep_pinNumberGPIO pin to use for sleep function. -1 to disable. 
- 
                                              freefall_pinNumberGPIO pin to use for free fall (0g) detection. -1 to disable. 
- 
                                              range_pinNumberGPIO pin to select range (1.5g or 6g). -1 to disable. 
- 
                                              a_refNumberThe 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:
- 
                                              rangeBooleantrue for 6G, false for 1.5G 
setSleep
                      
                              - 
                                              sleep
Set sleep mode. When in sleep mode the sensor uses minimal power.
Parameters:
- 
                                              sleepBooleantrue 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:
- 
                                              enableBooleantrue 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:
- 
                                              xNumberOffset to apply to X value 
- 
                                              yNumberOffset to apply to Y value 
- 
                                              zNumberOffset 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:
- 
                                              xNumberScale to apply to X value 
- 
                                              yNumberScale to apply to Y value 
- 
                                              zNumberScale 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:
- 
                                              xFloat *a pointer in which X acceleration data will be returned 
- 
                                              yFloat *a pointer in which Y acceleration data will be returned 
- 
                                              zFloat *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:
- 
                                              xFloat *a pointer in which X volt data will be returned 
- 
                                              yFloat *a pointer in which Y volt data will be returned 
- 
                                              zFloat *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:
- 
                                              xFloat *a pointer in which X normalized ADC data will be returned 
- 
                                              yFloat *a pointer in which Y normalized ADC data will be returned 
- 
                                              zFloat *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.