GitXplorerGitXplorer
m

MraaSharp

public
4 stars
2 forks
2 issues

Commits

List of commits on branch master.
Unverified
891958423d3194d79c2bdfe88c904a56d840c28d

Merge branch 'master' of https://github.com/mayuki/MraaSharp.git

mmayuki committed 9 years ago
Unverified
9eeb4dbcd2da911804ddfa96a25d8188f7ad547a

fix invalid comment in XMLDocs.

mmayuki committed 9 years ago
Unverified
e5163ec7d1958caa14b987accbfe72edbf05189b

Update README.md

mmayuki committed 9 years ago
Unverified
557785177b085ade04ef58b89cce0dea19f20b6d

Update README.md

mmayuki committed 9 years ago
Unverified
6076d79ede0495575c4765b4c198ef508478dca1

Update README.md

mmayuki committed 9 years ago
Unverified
f9e194a23ec5fa6c4c7c28a86cabf4b1fae2392c

Initial import

mmayuki committed 9 years ago

README

The README file for this repository.

MraaSharp

.NET(C#) binding/wrapper for Intel MRAA library.

The wrapper library written in 100% pure C#. So you don't need to build or write SWIG wrapper.

Testing Environment

  • Intel Edison + Breakout Board Kit
    • Intel Edison® Board Firmware Software Release 2.1
  • Mono 4.0.3

Status

API Status
aio
common ✔️
gpio InProgress(90%)
i2c
iio
pwm ✔️(Not tested)
spi
uart ✔️(Not tested)

Sample Code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

using MraaSharp;

namespace ConsoleApplication21
{
    class Program
    {
        static void Main(string[] args)
        {
            Mraa.Initialize();
            Console.WriteLine("Version: {0}", Mraa.Version);
            Console.WriteLine("PlatformName: {0}", Mraa.PlatformName);

            var gpio = new Gpio(MraaIntelEdisonMiniboard.J17_8, MraaGpioDir.Out);
            Console.WriteLine("Gpio Pin: {0}", gpio.Pin);
            Console.WriteLine("Gpio PinRaw: {0}", gpio.PinRaw);

            while (true)
            {
                gpio.Write(MraaGpioValue.High);
                Thread.Sleep(1000);
                gpio.Write(MraaGpioValue.Low);
                Thread.Sleep(1000);
            }
        }
    }

}

... and you can manipulate MRAA interactively with C# Shell (Mono's csharp command).

root@harusame:~/tmp# mono /usr/lib/mono/4.5/csharp.exe
Mono C# Shell, type "help;" for help

Enter statements below.
csharp> LoadAssembly("MraaSharp");
csharp> using MraaSharp;
csharp> Mraa.Initialize();
csharp> Mraa.Version;
"v0.8.0"
csharp> Mraa.PlatformName;
"Intel Edison"
csharp> var gpio = new Gpio(MraaIntelEdisonMiniboard.J17_8, MraaGpioDir.Out);
csharp> gpio.Pin
7
csharp> gpio.Write(MraaGpioValue.High);
csharp> gpio.Write(MraaGpioValue.Low);
csharp>