I am new to c#. I have a serial (COM port) device which is streaming an array of bytes continuously. The array contains values of different sensors which are read by micro-controller. Basically the value of each sensor is shown by 8 bytes such that each byte represents an ascii character.There is no delimiter between these bytes. After 32 bytes, we have two bytes of a carriage (D) and a new line (A).
I use serialPort1.ReadExisting() to read data from serial port and then display readings in a textbox. However, I need the numeric values of these sensors for plotting and calculations. How can I convert these values to float numbers? Or how should I change the way I am reading serial port.
I really appreciate your help!
Int32.Parse()
to convert to integer, otherwise it depends of the encoding of the value – HubertL