I got a Licor CO2-Logger (Li-820) for a scientific experiment. The Li-820 outputs an analog signal (voltage) and also offers a serial communication via a RS-232 port. I would like to sniff the serial communication with an Arduino Uno and display the CO2 values on a LCD display such that I can control the analog signal that is logged in a computer system. I want to display both the analog and the digital signal.
I use a RS-232 level shifter to connect the Licor CO2 analyzer to the Arduino Uno, and I can sniff the COM port successfully both with the Arduino serial monitor and a sniffer program. Over the RS-232 port the Li-820 device outputs an XML-like line that is as follows (Line breaks and indentation added for readability):
<li820> <data> <celltemp>5.1252350e1</celltemp> <cellpres>9.7159633e1</cellpres> <co2>5.2527637e2</co2> <co2abs>7.7893261e-2</co2abs> <ivolt>1.1386718e1</ivolt> <raw>3950702,3808028</raw> </data> </li820>
I would like to parse that information for the relevant part with the Arduino Uno which is the
<co2>5.2527637e2</co2> ("CO2" value) and first output it to the serial monitor. Next, I will display that value on a LCD display. This last step should be a minor problem.
So, how can I parse the information for the relevant bits and then display it to the serial monitor?
I looked into many examples on the Internet. A modified version of the working code from here was the closest I got.