http://mbed.org/teams/components/code/MotionSensor/#4d6e28d4a18a