Accelerometer code