Git Product home page Git Product logo

raspberry-gpio-manager's Introduction

RaspberryGPIOManager ย  raspberrypi.org

This simple C# library allows you to easily manage any GPIO pin on your Raspberry Pi. If you wish to learn more about GPIO, you may want to look at this. To see an example on how the library works, see below.


Notice: I'm currently performing major changes to the code and the repository. Sorry if I'll mess up and break some source files.

Compiling

If you're keeping your RPi setup as lightweight as possible and you're not using an IDE you can compile this library and your project as follows:

mcs -t:library GpioPin.cs Exceptions.cs -out:Raspberry-GPIO-Manager.dll

mcs -reference:"path/to/previous/generated.dll" yourProject.cs

GPIOPinDriver object

The GPIOPinDriver object is the one you need to build in order to perform any action. In its constructor you have to specify the GPIO pin to associate, and you may also want to give the direction and the initial value to assign.

var pin1 = new GPIOPinDriver(GPIOPinDriver.Pin.GPIO23);

var pin2 = new GPIOPinDriver(GPIOPinDriver.Pin.GPIO23, GPIOPinDriver.GPIODirection.Out, GPIOPinDriver.GPIOState.Low);

GPIOPinDriver properties

Once you have created your object(s), you can access following properties:

Direction - In or Out, (treat it as an input or output pin)

GPIOPin - [Readonly] The pin that is being controlled.

State - The current value of the signal. In output mode this property can be used to switch on or off the pin, in input mode to read the value of it (High/Low).

Coming Soon

  • Possibility to handle events on GPIO pin state changes
  • Object to handle serial communication

Notes

GPIOPinDriver class implements IDisposable interface, that is to say it should be disposed at the end, calling either Dispose() or Unexport() function.

IMPORTANT: Accessing GPIO pins require root permissions!


Raspberry Pi is a trademark of the Raspberry Pi Foundation.

raspberry-gpio-manager's People

Contributors

alexsartori avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.