Distance Sensor function