I am trying to read a pin on my Pi 3 model B+. It runs on raspbian, the application is programed in C# and I use mono to run it. I'm using the RaspberryPiDotNet library, which I compiled in windows found here

I have tried several pins, several constructors, of course googled, but I just can't to get it to work. The value stays on "low", whatever I am doing. When I use WiringPi in the Bash Shell it works.

What is a bit strange is, when reading the pin with WiringPi I read pin# 17. According to this website it should be 0. I tried to read different pins, but it still stays on "low". What could it be, that I am doing wrong?

I am looking into alternatives to use instead of RaspberryPiDotNet. One thing I noticed is, that most libraries seem to be pretty old and therefor could be outdated. Maybe someone could link me to a library which is known to be working.

Thank you in advance! regards, joe

GPIOMem GPIOPin = new GPIOMem(GPIOPins.GPIO_17, GPIODirection.In);

            while (true)
                Console.WriteLine("GPIO_17: ");
                GPIOPin.PinDirection = GPIODirection.In;
                Console.WriteLine("Pin Direction: " + GPIOPin.PinDirection);
                Console.WriteLine("Pin Read: " + GPIOPin.Read());
                Console.WriteLine("Pin: " + GPIOPin.Pin);

  • There are at least three different GPIO numbering schemes. 1) Broadcom GPIO number, 2) board pin number, 3) wiringPi number. You need to double check that you are consistent in the scheme you are using. pinout.xyz – joan Aug 9 '19 at 10:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.