public void Start() { Enable(); sensorTask = Task.Run(() => { while (motorController == null) { } while (true) { while (!running) { Task.Delay(150).Wait(); } Utils.Orientation orientation = sensor.GetOrientation(); if (orientation != null) { SetOwnOrientation(orientation.yaw, orientation.pitch, orientation.roll); } } }); }