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

ADXL335 3 Axis Accelerometer

The ADXL335 is a 3 axis accelerometer from Analog Devices capable of measuring ±3g.
Data sheet: http://www.sparkfun.com/datasheets/Components/SMD/adxl335.pdf
Supplier: http://www.sparkfun.com/commerce/product_info.php?products_id=9268
This library assumes that the device is using the default 3 volt supply.
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