diff --git a/examples/c++/mhz16.cxx b/examples/c++/mhz16.cxx index bb46ae26..542dc5fd 100644 --- a/examples/c++/mhz16.cxx +++ b/examples/c++/mhz16.cxx @@ -62,14 +62,15 @@ int main (int argc, char **argv) sleep(1); - int gas; - int temp; - while (shouldRun) { - co2->getData(&gas, &temp); - cout << "CO2 concentration: " << gas << " PPM, " - << "Temperature (in C): " << temp <getData()){ + cerr << "Failed to retrieve data" << endl; + continue; + } + + cout << "CO2 concentration: " << co2->getGas() << " PPM, " + << "Temperature (in C): " << co2->getTemperature() <