Answer the question
In order to leave comments, you need to log in
Parsing in C# (VisualStudio2019)?
I am quite new to C#.
Data from sensors is transmitted from Arduino to the Serial port in the format: 0, sensor reading 1,1, sensor reading 2, ... (index, terminator, value).
In VisualStudio2019 a form is created on it's label1...etc.
it is necessary to write in label1 only the reading of sensor1, in label2 write only the reading of sensor2, etc.
Answer the question
In order to leave comments, you need to log in
0,показ.датчика1,1,показания датчика2,...
It appears to be CSV.
Parsing it is terribly easy:
var values = "0,123.5,1,456.25".Split(',');
var firstSensorValue = double.Parse(values[1]);
var secondSensorValue = double.Parse(values[3]);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question