Code For the Motion Sensor