DC motor control with PID

Accelerometers are used to sense both static (gravity) and dynamic (sudden starts/stops) acceleration - in m/s² or g.
Gyroscopes measure angular velocity, how fast something is spinning about an axis - in RPM, or degrees per second.
Accelerometer data are noisy, Gyros tend to drift; the combination (data fusing) gives usable information

See: http://www.sparkfun.com/commerce/tutorial_info.php?tutorials_id=167