c# - Get input from serial port (RS-232) -
/ Strong>
this should be on the right
Sending ... sending ... Sending ... sending ... Sending ... without changing lines
Actual input Sending ... to ndin g ... S endi ng ... sending. ..nindin g ... Code Public Zero Serial ({{serialport serial = new} serialport this.comboBox1.Text); serial. baud right = 9600; Siriylkprayta = Smtaknhin serial. stop port =. a; serial. Detabits = 8; serial. Hndsek = handshake tread; serial. recover data + = new SerialDataReceivedEventHandler (SerialDataReceivedHandler); serial.Open ();} catch {}} public void Siriyldetakshithandlr (object sender, SerialDataReceivedEventArgs e) {SerialPort sp = (SerialPort) sender; string These data = sp.ReadExisting (); if (Log_ time == true) {this.richTextBox1.AppendText (time + data in);} other {this.richTextBox1.AppendText (data in + "\ n");}} < / Code> this.combobox1.Text is working fine, im using to try because if not then crashed the program if no serial port! I can get the right input
in the second section, you this.richTextBox1 the "\ n" Should not be attached. This special character to a new line if you want to correct input, then this.richTextBox1.AppendText (dataIn + "..."),
Comments
Post a Comment