Basic pH read program for HAOSHI H-101 pH probe Still needs calibrating requires only 5V and ADC pin

Dependencies:   mbed Map

Files at this revision

API Documentation at this revision

Comitter:
dnonoo
Date:
Wed Apr 10 19:39:48 2019 +0000
Parent:
0:4494f6ceb276
Commit message:
yes;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 4494f6ceb276 -r ab2a9277c379 main.cpp
--- a/main.cpp	Mon Apr 08 13:05:19 2019 +0000
+++ b/main.cpp	Wed Apr 10 19:39:48 2019 +0000
@@ -1,7 +1,6 @@
 #include "mbed.h"
 #include "Map.hpp"
 
-#
 
 DigitalOut led_green(LED1);
 DigitalOut led_red(LED2);
@@ -14,7 +13,7 @@
 float avg;
 float phval;
 
-Map map (0, 1.0f, 0, 14);
+Map map (0, 1.0f, 0, 14.0f);
 
 int main()
 {
@@ -43,7 +42,8 @@
             avg +=buf[i];
         }// end for 1
         avg = avg/6;
-        pc.printf("avg = %.2f\n\r", avg);
+        avg = avg - 0.15f;
+        pc.printf("avg = %.6f\n\r", avg);
         phval = map.Calculate(avg);
         pc.printf("pH = %.2f\n\r", phval);                   
         }// end while 1