【发布时间】:2023-03-25 13:18:01
【问题描述】:
我是 Windows 10 IoT 的新手。我已经使用微控制器几年了,也许这是我的坏习惯。我正在构建一个应用程序,它需要“ping”几个 GPIO,直到在它们之间找到特定的组合。一旦找到,图形界面应该会做动画。
我的问题如下:在显示图形界面的同时在后台连续循环的最佳方法是什么?
我目前正在做如下:
初始化GPIO();
timer = new DispatcherTimer();
timer.Interval = TimeSpan.FromMilliseconds(0.05);
timer.Tick += Timer_Tick;
if (init)
timer.Start();
和
private void Timer_Tick(object sender, object e)
{
//Here I loop the GPIO. I f a comkbination is found, the graphical interface is triggered.
}
有没有更好的办法?
谢谢!
【问题讨论】: