Sensing tilt using accelerometer alone

atan2() just saves you the trouble of dividing the Opposite side by the Adjacent side. It also preserves quadrant information that would be lost in the division.

Tangent = Opposite over Adjacent