WebbotLib AVR library
WebbotLib It just does it
  C++ documentation  C documentation

Freescale/MMA7260QT.h

The MMA7260QT is a 3 axis accelerometer from Freescale capable of measuring up to ±6g in four different sensitivity ranges.
Data sheet: http://www.pololu.com/file/download/MMA7260QT.pdf?file_id=0J87
Supplier: http://www.pololu.com/catalog/product/766
MMA7260QT.jpg
The device requires one ADC pin for each axis and this library provides four different constructors - one for each sensitivity range:
MAKE_FS_MMA7260QT_1g5(channelX, channelY, channelZ)
MAKE_FS_MMA7260QT_2g(channelX, channelY, channelZ)
MAKE_FS_MMA7260QT_4g(channelX, channelY, channelZ)
MAKE_FS_MMA7260QT_6g(channelX, channelY, channelZ)
For example on the Axon you could define a sensor using the 2g range as follows:-
#include "Freescale/MMA7260QT.h"
FS_MMA7260QT accel = MAKE_FS_MMA7260QT_2g(ADC0,ADC1,ADC2);
Note that you will still need to set the jumpers on the device to select the 2g range.
Having caused the sensor to be read using:-
accelerometerRead(accel);
Each axis can then be read independently:-
ACCEL_TYPE x = accel.accelerometer.x_axis_mG;
ACCEL_TYPE y = accel.accelerometer.y_axis_mG;
ACCEL_TYPE z = accel.accelerometer.z_axis_mG;
The values returned are in 'mG' ie 1000ths of the gravitational constant.

Valid XHTML 1.0 Transitional