Using Gpio on Raspberry Pi 4 B with uno-platform

358 views Asked by At

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: enter image description here

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?

1

There are 1 answers

0
AudioBubble On BEST ANSWER

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

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