Last active
April 21, 2018 16:49
-
-
Save Ekus/4f86aba04487bdb452a4 to your computer and use it in GitHub Desktop.
An ASP.NET page that controls Arduino using USB to Serial connection. I use it to have the Arduino send an IR signal that turns my TV on/off. I use Amazon Echo to send a GET request to this page when I say "Alexa, turn on/off the TV"
This file contains hidden or 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
<%@ Page Language="C#" AutoEventWireup="true" %> | |
<%@Import Namespace="System.IO.Ports" %> | |
<script runat="server"> | |
protected void Page_Load(object sender, EventArgs e) | |
{ | |
using (SerialPort sp = new System.IO.Ports.SerialPort()) | |
{ | |
sp.PortName = "COM3"; | |
sp.BaudRate = 9600; | |
sp.Open(); | |
sp.Write("1"); | |
System.Threading.Thread.Sleep(100); | |
sp.Write("1"); | |
sp.Close(); | |
} | |
} | |
</script> | |
<html> | |
<body> | |
<h1>HI</h1> | |
<%=System.DateTime.Now %> | |
</body> | |
</html> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hjgjygh