protected void Page_Load(object sender, EventArgs e) { ardo = new SerialPort(); ardo.PortName = "COM5"; ardo.BaudRate = 9600; } protected void BlueOn(object sender, EventArgs e) { if(Session["currentState"] == null) Session["currentState"] = "2"; if(Session["currentState"].ToString() == "1") { Session["currentState"]= "2"; } else { Session["currentState"]= "1"; } ardo.Open(); ardo.Write(Session["currentState"].ToString()); ardo.Close(); }
private void BlueOn_Click(object sender, EventArgs e) { //This will be fired as soon as the button is clicked //Code for on condition } private void BlueOn_MouseUp(object sender, MouseEventArgs e) { //This will be fired as soon as you release the click //Code for off condition }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)