Initiate PWM on a Raspberry Pi runs in a SEHException

人走茶凉 提交于 2019-12-23 02:09:46

问题


I am currently realizing a project in C # on a Raspberry Pi 3. On the Pi, Windows runs IoT Core in the latest stable release release (v.10.0.16299.309). When I initiate the PWM pins, the method runs in an exception (System.Runtime.InteropServices.SEHException: 'External component raised an exception.'). All rights are set and all releases are set on the Windows Fall Creators Update. Can someone be with me. Thank you.

here the Code:

private async void StartPWM()
    {
        GpioController gpioController = await GpioController.GetDefaultAsync();
        if (LightningProvider.IsLightningEnabled)
        {
            try
            {
                LowLevelDevicesController.DefaultProvider = LightningProvider.GetAggregateProvider();
                var pwmControllers = await PwmController.GetControllersAsync(LightningPwmProvider.GetPwmProvider());
                var pwmController = pwmControllers[1];
                pwmController.SetDesiredFrequency(50); //<---- Here it crasches

                dictionaryPwm = new Dictionary<int, PwmPin>
                {
                    {23,PWM.ActivatePwmPin(23,pwmController) },
                    {24,PWM.ActivatePwmPin(24,pwmController) }
                };
            }
            catch(Exception exception)
            {
                throw exception;
            }
        }
    }

回答1:


I ran into this same issue. In your project properties, try setting up your Targeting as follows:



来源:https://stackoverflow.com/questions/49461643/initiate-pwm-on-a-raspberry-pi-runs-in-a-sehexception

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!