Esempio n. 1
0
 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));
 }
Esempio n. 2
0
 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);
     }
 }
Esempio n. 3
0
 public Form1()
 {
     InitializeComponent();
     if (!Srl_MySerial.IsOpen)
     {
         Srl_MySerial.Open();
         Rtb_RX.Text = "Port Opened :";
     }
     else
     {
         Rtb_RX.Text = "Port Busy :";
     }
 }
Esempio n. 4
0
 private void Form1_FormClosed(object sender, FormClosedEventArgs e)
 {
     Srl_MySerial.Close();
 }
Esempio n. 5
0
 private void Btn_Send_Click(object sender, EventArgs e)
 {
     Srl_MySerial.Write(Rtb_TX.Text);
 }