HorrorInferno
@HorrorInferno
веб-разработчик, бэкэндер

Непонятное исключение на Raspberry Pi 3 + Windows 10 IoT Core, что делать?

Здравствуйте.
Есть Raspberry Pi 3, по нажатию на физическую кнопку должна делаться фотография с вебки. При нажатии на эту кнопку вылетает исключение "Pin ' is currently opened in an incompatible sharing mode. Make sure this pin is not already in use by this application or another application".
Как я понял, приложение думает, что пин уже занят каким-то другим приложением. Но дело в том, что на малинке щас нет других приложений, за исключением уже встроенных.
Что делать не знаю, помогите пожалуйста.
Код:
Код
private const int BUTTON_PIN = 6;
        private GpioPin buttonPin;

        public MainPage()
        {
            this.InitializeComponent();
            InitGPIO();
        }

        private void InitGPIO()
        {

            var gpio = GpioController.GetDefault();

            // Show an error if there is no GPIO controller
            if (gpio == null)
            {
                GpioStatus.Text = "There is no GPIO controller on this device.";
                return;
            }

            
            buttonPin = gpio.OpenPin(BUTTON_PIN);

            // Check if input pull-up resistors are supported
            if (buttonPin.IsDriveModeSupported(GpioPinDriveMode.InputPullUp))
                buttonPin.SetDriveMode(GpioPinDriveMode.InputPullUp);
            else
                buttonPin.SetDriveMode(GpioPinDriveMode.Input);

            // Set a debounce timeout to filter out switch bounce noise from a button press
            buttonPin.DebounceTimeout = TimeSpan.FromMilliseconds(50);

            // Register for the ValueChanged event so our buttonPin_ValueChanged 
            // function is called when the button is pressed
            buttonPin.ValueChanged += buttonPin_ValueChanged;

            GpioStatus.Text = "GPIO pins initialized correctly.";
        }

        private void buttonPin_ValueChanged(GpioPin sender, GpioPinValueChangedEventArgs e)
        {
            takePhoto();
        }

  • Вопрос задан
  • 273 просмотра
Пригласить эксперта
Ответы на вопрос 1
@Billy_Milligan
6 - земля вроде, или я что то путаю?)

3c94ec1da5784304ba315cb6bb8ff6ff.png
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы