[英]Using Gpio on Raspberry Pi 4 B with uno-platform
I realy hope im not the only one having this problem (i deleted my previous Question because it seems kinda missleading so heres my secont attempt)我真的希望我不是唯一一个遇到这个问题的人(我删除了我以前的问题,因为它似乎有点误导,所以这是我的第二次尝试)
I try to use the Rasbpery pi 4b GPIO Pins using a Uno app:我尝试使用 Uno 应用程序使用 Rasbpery pi 4b GPIO 引脚:
i tried it before with a consol APP and it works:我之前用 consol APP 尝试过,它可以工作:
Console APP Code:控制台APP代码:
using System;
using System.Device.Gpio;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Startet");
int pin = 17;
GpioController controller = new GpioController();
controller.OpenPin(pin, PinMode.Output);
Console.WriteLine("Enter to Turn HIGH");
Console.Read();
Console.WriteLine("is HIGH");
controller.Write(pin, PinValue.High);
Console.WriteLine("Enter to Turn LOW");
Console.Read();
Console.WriteLine("is LOW");
controller.Write(pin, PinValue.Low);
}
}
}
The code above works fine.上面的代码工作正常。 Now my attempt in UNO:现在我在 UNO 的尝试:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
using System.Device.Gpio;
namespace App1
{
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
}
bool SwitchOnOffReminder;
private void Test_Click(object sender, RoutedEventArgs e)
{
int pin = 17;
GpioController controller = new GpioController();
controller.OpenPin(pin, PinMode.Output);
Ausgabe.Text = "Meldung\n";
Ausgabe.Text = Ausgabe.Text + controller.GetPinMode(pin).ToString();
if (SwitchOnOffReminder== false)
{
SwitchOnOffReminder= true;
Ausgabe.Text = Ausgabe.Text + "Pin HIGH";
controller.Write(pin, PinValue.High);
}
else
{
SwitchOnOffReminder= false;
Ausgabe.Text = Ausgabe.Text + "Pin LOW";
controller.Write(pin, PinValue.Low);
}
}
}
}
The Result: it does not work and the Raspberry console is displaying: Uno.UI.Runtime.skia.GtkCoreWindowsExtension[0] Pointer capture release is not supported on Gtk"结果:它不起作用,Raspberry 控制台显示:Uno.UI.Runtime.skia.GtkCoreWindowsExtension[0] Gtk 不支持指针捕获发布”
can someone Help me with that?有人可以帮我吗?
As @JérômeLaban answered in the comment:正如@JérômeLaban 在评论中回答的那样:
you can find the solution here: github.com/unoplatform/uno/issues/3813你可以在这里找到解决方案:github.com/unoplatform/uno/issues/3813
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.