在 Raspberry Pi 上启动 PWM 在 SEHException 中运行 [英] Initiate PWM on a Raspberry Pi runs in a SEHException

查看:61
本文介绍了在 Raspberry Pi 上启动 PWM 在 SEHException 中运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在 Raspberry Pi 3 上用 C# 实现一个项目.在 Pi 上,Windows 运行最新稳定版本 (v.10.0.16299.309) 中的 IoT Core.当我启动 PWM 引脚时,该方法在异常中运行(System.Runtime.InteropServices.SEHException:'外部组件引发异常.').所有权利和所有版本都在 Windows Fall Creators Update 上设置.有人可以陪我吗.谢谢.

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.

这里是代码:

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;
            }
        }
    }

推荐答案

我遇到了同样的问题.在您的项目属性中,尝试按如下方式设置您的定位:

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

这篇关于在 Raspberry Pi 上启动 PWM 在 SEHException 中运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆