Dependencies:   SPS30-sensor

Revision:
1:6a9693f310f7
Parent:
0:732c556ef648
Child:
2:225c3f2a2a8a
--- a/main.cpp	Wed Jan 23 10:04:44 2019 +0000
+++ b/main.cpp	Fri Jan 25 09:52:40 2019 +0000
@@ -13,15 +13,28 @@
     while(1)
     {
         #ifdef SCD30
+        string co2val = "-------";
+        string tempval = "-----";
+        string humval = "-----";
+        
         int rdy = readySCD30();
-        setSCDparam();
-        string readco2 = readSCDco2();
-        string readtemp = readSCDtemp();
-        string readhum = readSCDhum();
-        if (rdy != 1) pc.printf("SCD30 not connected\r\n");
-        pc.printf("count: %d   CO2: %s ppm    Temp: %s C    Hum: %s % \r\n", count, readco2, readtemp, readhum);
+        int setchk = setSCDparam();
+        int datchk = readSCDmeas();
+        
+        pc.printf(" = %d  \r", datchk);
+        
+        if (datchk == 2)
+        {
+            co2val = getSCDco2();
+            tempval = getSCDtemp();
+            humval = getSCDhum();
+        }
+        
+        if (rdy != 0) pc.printf("SCD30 not connected\r\n");
+        if (setchk != 5) pc.printf(" Problem setting parameters..     Settings unchanged\r\n");
+        pc.printf("count: %4d  |  CO2: %s ppm  |  Temp: %s C  |  Hum: %s % \r\n", count, co2val, tempval, humval);
         #endif
-        wait(5);
+        wait(2);
         count++;
     }
 }