private void Srl_MySerial_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e) { rxString = Srl_MySerial.ReadExisting(); byte[] asciiBytes = Encoding.ASCII.GetBytes(rxString); rxString = " " + asciiBytes[0].ToString(); this.Invoke(new EventHandler(displayText)); }
private void Rtb_TX_KeyPress(object sender, KeyPressEventArgs e) { if (Srl_MySerial.IsOpen && Cb_IM.Checked) { char[] chr = new char[1]; chr[0] = e.KeyChar; Srl_MySerial.Write(chr, 0, 1); } }
public Form1() { InitializeComponent(); if (!Srl_MySerial.IsOpen) { Srl_MySerial.Open(); Rtb_RX.Text = "Port Opened :"; } else { Rtb_RX.Text = "Port Busy :"; } }
private void Form1_FormClosed(object sender, FormClosedEventArgs e) { Srl_MySerial.Close(); }
private void Btn_Send_Click(object sender, EventArgs e) { Srl_MySerial.Write(Rtb_TX.Text); }