Skip to content

Small Library to simplify the work with GPIOs on the Raspberry Pi in your .NetCore application

Notifications You must be signed in to change notification settings

tim-koehler/NetCoreGpioLibrary

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

.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 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:

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

Write/Read from GPIOs

To write a signal to a port:

Gpio.SetPortState(Port.PORT10, State.HIGH);  

To read a signal on a port:

Gpio.GetPortState(Port.PORT27);  

Example

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);
}

About

Small Library to simplify the work with GPIOs on the Raspberry Pi in your .NetCore application

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages