Skip to content

Instantly share code, notes, and snippets.

@jsakamoto
Created June 18, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jsakamoto/7acebd10a9a2fe5b01f6 to your computer and use it in GitHub Desktop.
Save jsakamoto/7acebd10a9a2fe5b01f6 to your computer and use it in GitHub Desktop.
How to turn on/off on Raspberry Pi GPIO port 25 by ASP.NET MVC action method.
// use TinyGPIO.cs
// https://github.com/sample-by-jsakamoto/SignalR-on-RaspberryPi/blob/master/myapp/TinyGPIO.cs
using myapp;
using System.Web.Mvc;
public class HomeController : Controller
{
[HttpPut]
public ActionResult TurnOnLED()
{
var gpio25 = TinyGPIO.Export(25);
gpio25.Direction = GPIODirection.Out;
gpio25.Value = 1;
}
[HttpPut]
public ActionResult TurnOffLED()
{
var gpio25 = TinyGPIO.Export(25);
gpio25.Direction = GPIODirection.Out;
gpio25.Value = 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment