Added function for reading accelerometer data.