How to read motion sensor data