简体   繁体   中英

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:

my setup: 在此处输入图像描述

i tried it before with a consol APP and it works:

Console APP Code:

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:

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"

can someone Help me with that?

As @JérômeLaban answered in the comment:

you can find the solution here: github.com/unoplatform/uno/issues/3813

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM