Win10 IoT - RaspBerry Pi2: ValueChanged не вызывается при изменении GPIO

Я тестирую Win10 IoT на моем Rpi2 со следующим кодом:

private void InitializeInterrupt()
{
    GpioController gpioController = GpioController.GetDefault();
    GpioPin buttonPin = gpioController.OpenPin(24);
    _ledPin= gpioController.OpenPin(25);

    buttonPin.SetDriveMode(GpioPinDriveMode.InputPullUp);
    _ledPin.Write(buttonPin.Read());

    _ledPin.SetDriveMode(GpioPinDriveMode.Output);
    buttonPin.ValueChanged += OnButtonChanged;
}

private void OnButtonChanged(GpioPin sender, GpioPinValueChangedEventArgs args)
{
    //I know the condition is inversed, I want the led UP when the button is not closed
    _buttonFeedbackPin.Write(args.Edge != GpioPinEdge.RisingEdge ? GpioPinValue.High : GpioPinValue.Low);
}

Проблема в том, что мой OnButtonChanged не вызывается. Я просто подключаю кнопку GPIO к земле (также тестируется на VCC).

Странная вещь в том, что если я вызываю вручную buttonPin.Read()Я правильно понял GpioPinValue внутри, так что я мог сделать не так

0 ответов

Другие вопросы по тегам