AirQualityClick on A0 on Nucleo-F411RE

Dependents:   AirQuality

Revision:
0:964a928b323e
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Air.h	Tue Apr 14 11:36:17 2015 +0000
@@ -0,0 +1,36 @@
+#ifndef AIR
+#define AIR
+
+#include "mbed.h"
+
+/// The load resistance on the board
+#define RLOAD 10.0
+/// Calibration resistance at atmospheric CO2 level
+#define RZERO 76.63
+/// Parameters for calculating ppm of CO2 from sensor resistance
+#define PARA 116.6020682
+#define PARB 2.769034857
+
+/// Parameters to model temperature and humidity dependence
+#define CORA 0.00035
+#define CORB 0.02718
+#define CORC 1.39538
+#define CORD 0.0018
+
+/// Atmospheric CO2 level for calibration purposes
+#define ATMOCO2 397.13
+
+class Air {
+ private:
+    AnalogIn _pin;
+ public:
+    Air (PinName pin);
+    float getCorrectionFactor(float t, float h);
+    float getResistance();
+    float getCorrectedResistance(float t, float h);
+    float getPPM();
+    float getCorrectedPPM(float t, float h);
+    float getRZero();
+    float getCorrectedRZero(float t, float h);
+};
+#endif