private void button2_Click(object sender, EventArgs e) { try { textInfo.Text = GPSSerialPort.ParseRespuesta(textBox1.Text).ToString(); } catch (Exception ex) { textInfo.Text = ex.Message; } }
private void button1_Click(object sender, EventArgs e) { string ans = serialPort1.ReadExisting(); txtRecibido.Text = ans; try { textInfo.Text = GPSSerialPort.ParseRespuesta(ans).ToString(); } catch (Exception ex) { textInfo.Text = ex.Message; } }
private void serialPort1_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e) { //txtRecibido.Text = serialPort1.ReadLine(); //serialPort1.Close(); //btnEnviar.Text = "Enviar"; string ans = serialPort1.ReadExisting().Split('<')[0]; txtRecibido.Text = ans; try { textInfo.Text = GPSSerialPort.ParseRespuesta(ans).ToString(); } catch (Exception ex) { textInfo.Text = ex.Message; } System.Threading.Thread.Sleep(1000); }