Created
June 18, 2015 14:01
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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