Library for MQ7 gas sensor

Dependents:   Garage_Control

Files at this revision

API Documentation at this revision

Comitter:
pkunnals
Date:
Fri Mar 19 18:57:26 2021 +0000
Parent:
0:398854b7b855
Commit message:
Modified

Changed in this revision

MQ7.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 398854b7b855 -r beae29b45281 MQ7.cpp
--- a/MQ7.cpp	Sun Jul 02 11:37:29 2017 +0000
+++ b/MQ7.cpp	Fri Mar 19 18:57:26 2021 +0000
@@ -7,13 +7,13 @@
 }
 int MQ7::get_CO_value(){
     float a = _pinA.read_u16();
-    printf("%f\r\n",a);
-    if(a<16384){
-        return 0;
-    }else if(a> 16383 && a<32768){
+    printf("CO ADC Value = %f\r\n",a);
+    if(a<20000){
         return 1;
-    }else if(a>32767 && a<49152){
+    }else if(a> 20000 && a<26000){
         return 2;
+    }else if(a>=26000 && a<49152){
+        return 3;
     }else{
         return 3;
         }