static void sp_DataReceived(object sender, SerialDataReceivedEventArgs e) { if( TemperaturaPort.BytesToRead > 0 ) { provabyte = TemperaturaPort.ReadByte(); Ricevo = Convert.ToString(provabyte); if ((provabyte == 13) || (provabyte == 10)) { singolocarattere = Ricevo; if (singolocarattere.Contains("TempInterna:" )) { TemperaturaInterna = singolocarattere.Substring(13); Ricevo = ""; } if (singolocarattere.Contains("TempEsterna:")) { TemperaturaEsterna = singolocarattere.Substring(13); Ricevo = ""; } if (singolocarattere.Contains("TempScheda:")) { TemperaturaScheda = singolocarattere.Substring(13); Ricevo = ""; } if (singolocarattere.Contains("TempScheda:")) { TemperaturaScheda = singolocarattere.Substring(13); Ricevo = ""; } if (singolocarattere.Contains("UmiditaInterna:")) { TemperaturaScheda = singolocarattere.Substring(15); Ricevo = ""; } } else { Ricevo = Ricevo + (char)provabyte; } {
serialPort1.WriteLine("Data Input String");
... // Read myString from Serial Port // // Then Replace \r\n with Empty myString = myString.Replace("\r\n", string.Empty);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)