|
Re: Programming acc/gyro
I suggest you look at the ADXL345 I2C Accelerometer example project to get started.
To measure your tilt, read the horizontal (either X or Y) and vertical (Z) acceleration axes and feed them into a rectangular-to-polar coordinate conversion function. The angle output will tell you which direction is "up" according to gravity.
|