https://github.com/tim-koehler/netcoregpiolibrary
Small Library to simplify the work with GPIOs on the Raspberry Pi in your .NetCore application
https://github.com/tim-koehler/netcoregpiolibrary
dotnet-core dotnetcore gpio gpio-library raspberry-pi
Last synced: 10 months ago
JSON representation
Small Library to simplify the work with GPIOs on the Raspberry Pi in your .NetCore application
- Host: GitHub
- URL: https://github.com/tim-koehler/netcoregpiolibrary
- Owner: tim-koehler
- Created: 2018-06-20T19:29:32.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-06-20T19:39:32.000Z (about 8 years ago)
- Last Synced: 2025-03-10T18:29:19.091Z (over 1 year ago)
- Topics: dotnet-core, dotnetcore, gpio, gpio-library, raspberry-pi
- Language: C#
- Size: 35.2 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# .NetCoreGpioLibrary for Raspberry Pi
This is a small Library to simplify the work with GPIOs on the Raspberry Pi in your .NetCore application.
## Prerequisites
You should already have a working .NetCore environment on your Raspberry set up.
## Installation
1. [Download](https://github.com/RaZorfalkon/NetCoreGpioLibrary/releases) the dll file
2. Add the library to your existing Project
## Use the library
### Setup GPIO ports
Before using a GPIO port you have to configure it:
```c#
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:
```c#
Gpio.SetUpPort(Port.PORD27, Direction.IN, true); // Read from inverted port
```
### Write/Read from GPIOs
To write a signal to a port:
```c#
Gpio.SetPortState(Port.PORT10, State.HIGH);
```
To read a signal on a port:
```c#
Gpio.GetPortState(Port.PORT27);
```
### Example
```c#
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);
}
```