iot_water_monitor_v2

Dependencies:   easy-connect-v16 Watchdog FP MQTTPacket RecordType-v-16 watersenor_and_temp_code

Files at this revision

API Documentation at this revision

Comitter:
DuyLionTran
Date:
Wed Feb 14 14:56:00 2018 +0000
Parent:
36:d0b628087ac8
Child:
38:64e3e9acb49c
Commit message:
some small debug

Changed in this revision

Sensor/ReadSensor.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/Sensor/ReadSensor.cpp	Wed Feb 14 14:45:35 2018 +0000
+++ b/Sensor/ReadSensor.cpp	Wed Feb 14 14:56:00 2018 +0000
@@ -50,7 +50,7 @@
 
 void SENSOR_AnalogRead() {
     analogBuffer[analogBufferIndex] = (int)(DOSensor.read() * 100);
-    printf("Analog read %d \r\n", analogBuffer[analogBufferIndex]);
+    printf("Analog read %d (%.2f)\r\n", analogBuffer[analogBufferIndex], DOSensor.read());
     analogBufferIndex++;
     if(analogBufferIndex == SCOUNT) {
         analogBufferIndex = 0;
@@ -63,6 +63,7 @@
     }   
     /* read the value more stable by the median filtering algorithm */
     averageVoltage = getMedianNum(analogBufferTemp, SCOUNT) * (float)VREF; 
+    printf("Average voltage %.2f\r\n", averageVoltage);
     /* calculate the do value, doValue = Voltage / SaturationDoVoltage * SaturationDoValue(with temperature compensation) */
     doValue = (SaturationValueTab[0] + (int)(SaturationDoTemperature + 0.5)) * averageVoltage / SaturationDoVoltage;  
     printf("DO Value %.2f mg/L\r\n", doValue);