【发布时间】:2017-08-22 22:21:01
【问题描述】:
所以,
我正在使用 Raspberry Pi 模型 3b,并且我已成功在其上运行 .NetCore v2.0.1。我已经能够构建 CoreIOT Hello World 项目并在我的 Pi 上毫无问题地运行它现在我有一些使用 GPIO 板创建的自定义硬件,我认为在 .NETCore 中使用它的唯一方法是使用 FileSystem方法/sys/class/gpio我已经构建了一个非常小的应用程序
https://github.com/barkermn01/CanReader
里面没有太多东西,但是由于某种原因,当我运行应用程序时,我得到的只是一条消息,上面写着Proccess is terminating due to StackOverflowException 我不确定是什么原因造成的,里面没有太大的东西我不认为只是基本文件系统读取。
我唯一能想到的是它不喜欢无限循环
发件人:https://github.com/barkermn01/CanReader/blob/master/Program.cs
while (!exiting)
{
Console.Write("\rCurrent State " + state);
string input = Console.ReadLine();
if (input == "exit")
{
watcher.Stop();
exiting = true;
}
}
发件人:https://github.com/barkermn01/CanReader/blob/master/GPIOWatcher.cs
public void watch()
{
GPIO.Value val = Gpio.ReadValue();
while (val != OldValue)
{
val = Gpio.ReadValue();
if (Delegate != null)
{
Delegate.DynamicInvoke();
}
Thread.Sleep(10);
}
}
【问题讨论】:
标签: c# exception raspberry-pi .net-core