c# mono raspberry pi GPIO with Raspberry# getting Operation shouldn’t be legitimate

I am making an attempt to make use of Raspberry# library to carry out fundamental job whith GPIO pin on Raspberry PI (on and off). As per instance on github: https://github.com/raspberry-sharp/raspberry-sharp-io/wiki/Raspberry.IO.GeneralPurpose

Code:

        var led1 = ConnectorPin.P1Pin11.Output();
        var connection = new GpioConnection(led1);
        for (var i = 0; i < 100; i++)
        {
            connection.Toggle(led1);
            System.Threading.Thread.Sleep(250);
        }
        connection.Shut();

on line var connection = new GpioConnection(led1); I get exception:

"Operation shouldn't be legitimate because of the present state of the thing"

Stack hint

Unhandled Exception:
System.InvalidOperationException: Operation shouldn't be legitimate because of the present state of the thing
at Raspberry.IO.GeneralPurpose.GpioConnectionDriver..ctor () [0x00000] in <filename unknown>:0
at Raspberry.IO.GeneralPurpose.GpioConnectionSettings.get_DefaultDriver () [0x00000] in <filename unknown>:0
at Raspberry.IO.GeneralPurpose.GpioConnectionSettings..ctor () [0x00000] in <filename unknown>:0
at Raspberry.IO.GeneralPurpose.GpioConnection..ctor (Raspberry.IO.GeneralPurpose.GpioConnectionSettings settings, IEnumerable`1 pins) [0x00000] in <filename unknown>:0
at Raspberry.IO.GeneralPurpose.GpioConnection..ctor (Raspberry.IO.GeneralPurpose.PinConfiguration[] pins) [0x00000] in <filename unknown>:0
at Good day.Program.Predominant (System.String[] args) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.InvalidOperationException: Operation shouldn't be legitimate because of the present state of the thing
at Raspberry.IO.GeneralPurpose.GpioConnectionDriver..ctor () [0x00000] in <filename unknown>:0
at Raspberry.IO.GeneralPurpose.GpioConnectionSettings.get_DefaultDriver () [0x00000] in <filename unknown>:0
at Raspberry.IO.GeneralPurpose.GpioConnectionSettings..ctor () [0x00000] in <filename unknown>:0
at Raspberry.IO.GeneralPurpose.GpioConnection..ctor (Raspberry.IO.GeneralPurpose.GpioConnectionSettings settings, IEnumerable`1 pins) [0x00000] in <filename unknown>:0
at Raspberry.IO.GeneralPurpose.GpioConnection..ctor (Raspberry.IO.GeneralPurpose.PinConfiguration[] pins) [0x00000] in <filename unknown>:0
at Good day.Program.Predominant (System.String[] args) [0x00000] in <filename unknown>:0

I'm able to swap pin state with Python so nothing is fallacious with gadget.



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *