Example #1
0
        private void Tilt()
        {
            var yDirection = getYDirection(false);

            switch (yDirection)
            {
            case Direction.up:
                _lastY--;
                break;

            case Direction.down:
                _lastY++;
                break;

            case Direction.none:
                _foundY = true;
                return;

            case Direction.error:
                Debug.Print("Something went wrong in the pan logic - returned Direction.Error");
                break;
            }
            if (_lastY > 160)
            {
                _lastY = 90;               //if we went too far, Start over
            }
            if (_lastY < 90)
            {
                _lastY = 160;
            }

            _tiltServo.Degree = _lastY;
            Thread.Sleep(5);
            _tiltServo.disengage();
        }