Ruben Laguna’s blog

Arduino Tilt Sensor Using MMA7260Q Accelerometer

I’ve playing with the MMA7260Q accelerometer. Following the indications in

I connected X,Y and Z of the MMA7260Q breakout to A0, A1 and A2 of the Arduino. Then, GS1 and GS2 connected to ground to set the range to 1.5g. Ah, and of course, I connected ^SLEEP to VCC.

I managed to put together this piece of code that ouputs the tilt angles ρ(rho) , φ(phi); and Θ(theta) in degrees. I does automatic autozero calibration so before getting sensible results you should tilt the sensor around +/-90 degrees in every axis.