Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Raspberry.IO.GeneralPurpose

ebezine edited this pageFeb 25, 2013 ·35 revisions

TheRaspberry.IO.GeneralPurpose.dll assembly provides access to the Raspberry Pi GPIO pins.This project is available under a compiled, Nuget form: seeRaspberry.IO.GeneralPurpose Nuget.

Introduction

Raspberry.IO.GeneralPurpose namespace contains classes that provide three different levels of abstraction from the GPIO hardware pins:

Some components located inother Raspberry.IO namespaces, such asRaspberry.IO.Components, are based onIGpioConnectionDriver.

Samples

TheTest.Gpio.Chaser project provides a sample using the GPIO pins.

Getting Started

Basic access to the Raspberry Pi GPIO is done as follows:

Declare Raspberry.IO.GeneralPurpose namespace
using Raspberry.IO.GeneralPurpose;
Identify pins on your Raspberry Pi board

FollowingRaspberry Pin Numbering information.

Declare the pins

Here, as an output pin for pin P1-11.

var led1 = ConnectorPin.P1Pin11.Output();
Create a connection to the GPIO

Pins are passed as an argument ofGpioConnection initializer.

var connection = new GpioConnection(led1);
Use the connection

The following code toggle led status every 250ms.

for(var i = 0; i < 100; i++){    connection.Toggle(led1);    System.Threading.Thread.Sleep(250);}
Close the connection
connection.Close();
Clone this wiki locally

[8]ページ先頭

©2009-2025 Movatter.jp