This is a small Library to simplify the work with GPIOs on the Raspberry Pi in your .NetCore application.
You should already have a working .NetCore environment on your Raspberry set up.
- Download the dll file
- Add the library to your existing Project
Before using a GPIO port you have to configure it:
Gpio.SetUpPort(Port.PORT10, Direction.OUT); // Write to port
Gpio.SetUpPort(Port.PORD27, Direction.IN); // Read from port
If your input signal is inverted you can simply invert that:
Gpio.SetUpPort(Port.PORD27, Direction.IN, true); // Read from inverted port
To write a signal to a port:
Gpio.SetPortState(Port.PORT10, State.HIGH);
To read a signal on a port:
Gpio.GetPortState(Port.PORT27);
Gpio.SetUpPort(Port.PORT10, Directon.OUT);
while(true)
{
Gpio.SetPortState(Port.PORT10, State.HIGH);
Thread.Sleep(250);
Gpio.SetPortState(Port.PORT10, State.LOW);
Thread.Sleep(250);
}