simple accelerometer tracking adapted from API demos.