// Set chute rotation private void btnRotation_Click(object sender, EventArgs e) { string tx = RXWINDOW.Text; I_comPort.Write("sd_" + tx); Reset(); }
// DISCONNECT private void btnDisconnect_Click(object sender, EventArgs e) { if (I_comPort.IsOpen) { I_comPort.Close(); } btnConnect.Enabled = true; lblComPort.Text = "Disconnected"; MessageBox.Show("Disconnected", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void goForward() { string tx = txtVel.Text; if (tx == string.Empty) { tx = "100"; } I_comPort.Write("mf_" + tx); }
private void goLeft() { string tx = txtVel.Text; if (tx == string.Empty) { tx = "100"; } I_comPort.Write("ml_" + tx); }
private void RunSnowBlower() { string tx = RXWINDOW.Text; if (tx == string.Empty) { tx = "100"; } I_comPort.Write("sr_" + tx); Reset(); }
// CONNECT private void btnConnect_Click(object sender, EventArgs e) { I_comPort.PortName = RXWINDOW.Text; I_comPort.BaudRate = 9600; I_comPort.Open(); if (!I_comPort.IsOpen) { return; } btnConnect.Enabled = false; MessageBox.Show("Connected", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information); lblComPort.Text = "Connected - " + I_comPort.PortName; RXWINDOW.Text = ""; }
// Event for data recieved private void I_comPort_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e) { RxString = I_comPort.ReadExisting(); this.Invoke(new EventHandler(DisplayText)); }
private void StopSnowBlower() { I_comPort.Write("ss_"); Reset(); }
private void btnStopBrush_Click(object sender, EventArgs e) { I_comPort.Write("bs_"); Reset(); }
// Reset snowblower private void btnReset_Click(object sender, EventArgs e) { Reset(); I_comPort.Write("sR_"); }
private void FullStop() { I_comPort.Write("ms_"); Reset(); }