Example reading C02 concentration.
authorPhilipp Spitzer <philipp@spitzer.priv.at>
Wed, 21 Oct 2020 19:50:18 +0000 (21:50 +0200)
committerPhilipp Spitzer <philipp@spitzer.priv.at>
Wed, 21 Oct 2020 19:50:18 +0000 (21:50 +0200)
airingbutler.ino [new file with mode: 0644]

diff --git a/airingbutler.ino b/airingbutler.ino
new file mode 100644 (file)
index 0000000..b1bbaf9
--- /dev/null
@@ -0,0 +1,29 @@
+#include <SoftwareSerial.h>
+#include "MHZ19.h"
+
+const int rx_pin = 2; // connect to TX on MHZ19
+const int tx_pin = 3; // connect to RX on MHZ19
+
+
+MHZ19 mhz19 = MHZ19(rx_pin,tx_pin);
+
+
+void setup()
+{
+    Serial.begin(115200);
+    mhz19.begin(rx_pin, tx_pin);
+}
+
+
+void loop()
+{
+    measurement_t m = mhz19.getMeasurement();
+
+    Serial.print("co2: ");
+    Serial.println(m.co2_ppm);
+    Serial.print("temp: ");
+    Serial.println(m.temperature);
+    
+    delay(500);
+}
+