|
@@ -56,16 +56,15 @@ print ("Make sure that the sensor has had "
|
56
|
56
|
"The temperature reported is not the ambient temperature,\n"
|
57
|
57
|
"but rather the temperature of the sensor elements.")
|
58
|
58
|
|
59
|
|
-gas = upmMhz16.new_intp()
|
60
|
|
-temp = upmMhz16.new_intp()
|
61
|
|
-
|
62
|
59
|
time.sleep(1)
|
63
|
60
|
|
64
|
61
|
while(1):
|
65
|
|
- myCO2.getData(gas, temp)
|
66
|
|
- outputStr = ("CO2 concentration: {0} PPM, "
|
67
|
|
- "Temperature (in C): {1}".format(
|
68
|
|
- upmMhz16.intp_value(gas), upmMhz16.intp_value(temp)))
|
69
|
|
- print outputStr
|
|
62
|
+ if (not myCO2.getData()):
|
|
63
|
+ print "Failed to retrieve data"
|
|
64
|
+ else:
|
|
65
|
+ outputStr = ("CO2 concentration: {0} PPM, "
|
|
66
|
+ "Temperature (in C): {1}".format(
|
|
67
|
+ myCO2.getGas(), myCO2.getTemperature()))
|
|
68
|
+ print outputStr
|
70
|
69
|
|
71
|
70
|
time.sleep(2)
|