Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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