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

MMA7260QT 3 axis (max g)

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
Note
Project Designer has several entries for this sensor depending upon the maximum acceleration you need to measure. Measuring larger 'g' values is done with less accuracy. Project Designer will show you how to set the jumpers for the 'g' range that you require.
Example
Assuming you have called the device 'myAccel' in Project Designer then add the following code to your 'appControl' function:-
// Read the accelerometer and store results
myAccel.read();
 
// Retrieve the x axis value in mG
ACCEL_TYPE x = myAccel.getX();
// Retrieve the x axis value in mG
ACCEL_TYPE y = myAccel.getY();
// Retrieve the x axis value in mG
ACCEL_TYPE z = myAccel.getZ();
 
// Each value can be printed to stdout:
cout << "X=" << x << " Y=" << y << " Z=" << z;
 
// or all values can be dumped to stdout out using
cout << myAccel;
The values returned are in 'mG' ie 1000ths of the gravitational constant.
Function Summary

Valid XHTML 1.0 Transitional